Medialon MxMs Help
Name: Beckhoff ADS
Version: 7.0.2.0
Available for: Manager V7 (Pro only)
Limitation In:  
Device Brand: Beckhoff
Positrack Compatible: No
Resources type:  

Overview

The Beckhoff ADS MXM provides reading, writing and change notification for variables in a Beckhoff TwinCAT device using the ADS protocol.

Installation

The Beckhoff ADS mxm is installed by default starting with Manager 7.1, or through a separate installer for prior Version 7 releases.

The ADS Mxm uses tcp/ip to connect to an ADS router, i.e. a PLC or TwinCAT software. It is necessary to setup the apppropriate routing in the remote ADS Router configuration, in order to allow the Manager instance to access the target device. This MxM does provide a simple method to automatically set ths route (see below) however, this may not be appropriate for all installations.

Please refer to Beckhoff’s online documention for further details. https://www.beckhoff.com/en-en/products/automation/twincat/

The following screenshot shows a example of setting a Route using the Route config page located in the system tray on TwinCAT system.
Note: Remote Route is set to None/Server.

Variable Mapping

In order to speed up the configuration effort and time for systems which might use a large number of mapped variables, this mxm uses a separate configuration file to provide details about the TwinCAT target system. This version of the MXM supports 1,2 or 4 byte integers, strings, real values, Date and Time ADS variable types.

The config file uses a simple XML format as shown in the following example.

<ADSVariables>
    <Variable name="test1" adsname="MAIN.test1" cycleTime="100" size="2" notify="y"/>
    <Variable name="test2" adsname="MAIN.test2" type="integer" size="1"/>
    <Variable name="test3" adsname="MAIN.test3" type="string" />
    <Variable name="test4" adsname="MAIN.test4" type="real" />
    <Variable name="adsDate" adsname="MAIN.test5" type="date" />
    <Variable name="adsTime" adsname="MAIN.test6" type="time" />
</ADSVariables>

This simple example creates 6 variables in the MXM that map to equivalent variables in the TwinCAT project. The matching code in the TwinCAT project would be something like..

PROGRAM MAIN
    VAR
        test1: INT;
        test2: BOOL;
        test3: STRING(20) := 'this is a string';
        test4: REAL;
        test5: DATE := D#2023-10-15;
        test6: TIME := T#2H30M40S500MS;
    END VAR

File Format

Note all Elements and Attributes are case sensitive.

The XML Root element will be “ADSVariables”

each mapped variable has a “Variable” tag with a set of attributes as follows.
Note: The colon is a protected character in Manager variables names. It is therefore not possible to just use the TwinCAT variable name as is, hence the manager mxm alias.

name: (required)
This is the mxm variable name.
adsname: (required)
This is the name used in the TwinCAT project.
cycleTime: (optional)
This is essentially the speed at which notifications are picked up by ADS. The default value is 1000 (1 second).
Note: setting lots of notifications with fast cycleTimes could impact Manager performance.
size: (optional)
This is the size in bytes of the variable. Note: if this isn’t provided, it will be determined at run time by the MXM. However, this does require additional network polling at the transition from stop mode to run/debug and could impact performance for large variable counts.
notify: (optional)
ADS provides a reactive notification feature, whereby changes to TwinCAT variables are sent to the MXM. Set this to ‘Y’ to enable notification for this variable.
Note: Notifications are a limited resource (1024 per Connection) in ADS.
type: (optional)
Type of the ADS variable. Can be integer,string or real. If the attribute is not set, Integer is assumed.

Device Setup

setup dialog

The setup screen contains the following fields.

Router IP Address
This is the IP Address for the target TwinCAT device.
Port
This is the TCP Port which ADS uses on the target device.
Auto Reconnect
When set, this option causes the Mxm to poll the State of the PLC every 5 seconds to check the state of the connection.
If a network error occurs or the PLC is taken out of run mode, the Mxm will attempt to reconnect every 5 seconds until successful.
Add Route before connection
In order for Manager to communicate with the PLC, a route is required on the PLC back to the Medialon PC (or showmaster). If this flag is set, the Mxm will automatically create a route when entering run or debug mode. The route will be created using the first IP address enumerated on the Manager PC. There may be times, multiple NIC’s for example, where this may not be the desired behaviour. If more control is required over the Route setup, then a static route can be created on the PLC itself.
Username
Username to use for creating a Route (NB. On a windows based system, this will be Windows credentials used to login)
Password
Password to use for creating a Route (NB. On a windows based system, this will be Windows credentials used to login)
Load Mapping File
Opens a file browser window that can be used to load a variable mapping file. See section above for details on this file.

Device Commands

The ADS MXM provides the following commands

ReadVar

Synchronously reads the value of a variable on the target TwinCAT device. The value is returned in the mapped mxm variable from the mapping file. Note if the value changes, this will trigger the ‘#’ variable Change notification. ReadVar is an alternative method to enabling notifications, which are a limited resource. It is advised to use ReadVar for slow polling of not critical values, and save notifications for time or show critical variables.

WriteIntegerVar

Synchronously writes a value to an Integer variable on the target TwinCAT device. Note the variable name must be included in the mapping file.

WriteStringVar

Synchronously writes a value to a string variable on the target TwinCAT device. Note the variable name must be included in the mapping file.

WriteRealVar

Synchronously writes a value to a Real variable on the target TwinCAT device. Note the variable name must be included in the mapping file.

WriteTimeVar

Synchronously writes a value to a Time variable on the target TwinCAT device. Note the variable name must be included in the mapping file.

WriteDateVar

Synchronously writes a value to a Date variable on the target TwinCAT device. Note the variable name must be included in the mapping file.

Device Variables

LinkStatus

[Enum] Specifies the Link Status for the ADS driver. Note this only reflect the state of the connection to a local router and not whether communication can be achieved to the target PLC.
0 - NotConnected
1 - Connected

Mapped Varables

[Integer,Real,String, Date, Time] Dynamic Variables which provide mirrors for user variables in a TwinCAT project.

Revisions

V 7.0.1

V 7.0.2