Beckhoff TwinCAT ADS to OPC UA
PLCGateway reads TwinCAT controllers over ADS and serves their variables from an OPC UA server, so MES and SCADA systems connect without an OPC UA function on every controller.
Beckhoff offers OPC UA as a TwinCAT function that is licensed and configured per controller. With several controllers, or with TwinCAT 2 systems in the field, a central gateway is often simpler: PLCGateway reads each controller over ADS and presents all of them in one OPC UA address space.
The symbol browser shows programs, global variable lists, structures and arrays; selected variables are added with the data type from the PLC. Controllers that already run an OPC UA server can be connected through the OPC UA client instead.
- Source
- Beckhoff TwinCAT ADS
ads - Connection
- ADS / AMS · TCP 48898 · UDP 48899
- Target
- OPC UA
- Writing
- yes
Set it up in five steps
Add a device with the protocol Beckhoff TwinCAT (ADS) and click Find TwinCAT systems; selecting the PLC fills in its IP address and AMS NetId.
Click Add route on the PLC and enter the user of the PLC (older Beckhoff images: Administrator / 1). This is needed once.
Open the symbol browser, select program and global variables and add them in one step – the data types come from the PLC.
Open Gateway → OPC UA and choose the security modes and whether clients sign in anonymously or with user name and password.
Connect your OPC UA client (UaExpert, an MES, a SCADA) to opc.tcp://<gateway>:4840 and browse Objects → PLCGateway.
Example: node ids in the OPC UA server
A device with the id cx1 and these tags appears in the address space as shown below. Names and values are examples.
| Tag | Address | Example value |
|---|---|---|
LineSpeed | MAIN.Speed | 12.5 m/min |
PumpRunning | GVL.Line1.Pump.Running | true |
Setpoint | MAIN.Recipe[3] | 75.5 °C |
OPC UA node ids
opc.tcp://<gateway>:4840
Objects / PLCGateway / cx1
ns=1;s=cx1.LineSpeed = 12.5
ns=1;s=cx1.PumpRunning = true
ns=1;s=cx1.Setpoint = 75.5
Every tag is a variable under Objects / PLCGateway / device in namespace 1; clients read it, write it and subscribe to its changes.
The OPC UA server in PLCGateway
Every tag becomes a variable in PLCGateway's built-in OPC UA server, so MES, ERP, SCADA and historians use one standard endpoint instead of each controller's own protocol. Clients browse the devices and tags, read, write and subscribe to value changes.
The server offers the security modes None, Sign and SignAndEncrypt with automatically generated certificates; clients sign in anonymously or with user name and password.
- One endpoint (opc.tcp, port 4840) for all devices and protocols
- A folder per device and a variable per tag, with description and unit
- Subscriptions with data-change notifications; writing only where the tag allows it
- Client certificates are approved in the web interface
Controllers and devices
Equipment that is typically connected with this driver.
Questions and answers
Is an OPC UA function needed on the controller?
No. Only ADS access is used: the gateway needs a route on the controller, which it adds itself.
Can structures and arrays be published?
Their members and elements are added as individual tags, for example GVL.Line1.Pump.Running or MAIN.Recipe[3]; a whole structure is not transferred as one value.
Is Secure ADS supported?
Not yet. The driver uses standard ADS over TCP 48898, so keep the gateway in the same protected machine network as the controllers; the OPC UA side can be encrypted.
Connect your machines
Tell us which controllers you run; we show you PLCGateway with your own addresses.
Product and model names are trademarks of their owners. They are named only to show which equipment the drivers communicate with; PLCGateway is not affiliated with these companies.
