Beckhoff Trigger
The Beckhoff Trigger fires a workflow whenever one of the trigger’s monitored symbols receive a new value on a Beckhoff Automation TwinCAT PLC.
Node Properties
The Beckhoff Trigger’s configuration is broken up across the following sections …
Configuration
Select what the source of the configuration for the trigger should be. The two options are:
- Individual Fields (Default): Fields are individually set within the node properties.
- Agent Config File: Pull a named configuration from your Gateway Edge Agent’s config file. This options is only available in Gateway Edge Agent Version 1.50.0 and higher.
When Agent Config File is chosen, you must provide the name of a configuration from your config file. That named configuration in your config file must contain the required connection configuration fields as well as at least one subscription. The type beckhoff
and a unique name field are also required.
Example (including all field names):
[[triggers]]
name = 'beckhoffTrig1'
type = 'beckhoff'
localAmsNetId = '192.168.5.221.1.2'
localAdsPort = 32750
targetAmsNetId = '5.123.154.18.1.1'
targetAdsPort = 851
routerHost = '127.0.0.1'
routerTcpPort = 48898
cycleTimeMs = 1000
subscriptionItems = [ 'GVL_Var.TestDint1', 'GVL_Var.TestDint2' ]
Connection Configuration
When Individual Fields is chosen as the configuration type, next define the properties needed to establish a connection to the Beckhoff PLC.
- Local AMS Net ID: A six-octet address of the local device (running the GEA) in the TwinCAT network. This is usually the IP address assigned to the GEA device plus
.1.1
. - Local ADS Port: The port over which the ADS communication protocol of TwinCAT is exposed. Defaults to
37250
. - Target AMS Net ID: A six-octet address of the target ADS device, usually defined on the device itself. Usually it is the IP address of the ADS device plus
.1.1
. - Target ADS Port: The target runtime ADS port. Defaults to
851
. - Router Host: The hostname or IP address of the TwinCAT router.
- Router Port: The port over which the TwinCAT router is exposed. Defaults to
48898
. - Cycle Time Interval (ms): The length of time, in milliseconds, to wait between requests to the PLC for the values of the subscribed symbol values. The minimum is
10
milliseconds and the maximum is3600000
(one hour). Lower numbers lead to quicker firing of workflows on value changes, but can also cause performance issues on the GEA device or the Beckhoff TwinCAT PLC.
Subscriptions
When Individual Fields is chosen as the configuration type, next specify at least one Symbol Name to monitor for value changes. Whenever a change in one of the provided symbol’s value is detected, the trigger will fire.
Note: If two or more symbol values change within the same cycle time, this will lead to the trigger firing once per changed symbol value.
Payload
The payload will include info on the changed symbol, as well as the new value and the timestamp of the change, in the data
field. Symbols with dot characters (.
) in their name will be treated as nested objects.
For example, given a monitored symbol name of GVL_Var.TestDint1
, the Beckhoff Trigger’s payload would look like the following …
{
"agentEnvironment": {
"EXAMPLE": "Environment Variable"
},
"agentVersion": "1.49.0",
"applicationId": "555555555555eeeeeeeeeeee",
"applicationName": "My Great Application",
"data": {
"GVL_Var": {
"TestDint1": {
"value": 528,
"timestamp": "2024-09-27T19:17:38.301Z",
"symbol": {
"name": "GVL_Var.TestDint1",
"comment": "",
"type": "DINT",
"size": 4,
"indexOffset": 384808,
"indexGroup": 16448
}
}
}
},
"device": {
"applicationId": "555555555555eeeeeeeeeeee",
"attributes": {
"exampleNumber": {
"attributeTags": {
"attrTagKey": "tagValue1"
},
"dataType": "number",
"name": "exampleNumber"
},
"exampleString": {
"attributeTags": {
"attrTagKey": "tagValue2"
},
"dataType": "string",
"name": "exampleString"
}
},
"creationDate": "2018-03-16T18:19:03.376Z",
"deviceClass": "edgeCompute",
"deviceId": "222222222222bbbbbbbbbbbb",
"id": "222222222222bbbbbbbbbbbb",
"name": "My Great Device",
"tags": {
"aTagKey": [
"exampleTagValue"
],
"tagWithMultipleValues": [
"tagValue",
"anotherTagValue"
]
}
},
"deviceId": "222222222222bbbbbbbbbbbb",
"deviceName": "My Great Device",
"deviceTags": {
"aTagKey": [
"exampleTagValue"
],
"tagWithMultipleValues": [
"tagValue",
"anotherTagValue"
]
},
"flowId": "333333333333cccccccccccc",
"flowName": "My Great Workflow",
"flowVersion": "myFlowVersion",
"globals": {
"aJsonGlobal": {
"key": "value"
},
"aNumberGlobal": 42,
"aStringGlobal": "My value"
},
"isConnectedToLosant": true,
"time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
"triggerId": "<{deviceId}-{randomAlphanumericString}>",
"triggerType": "beckhoff"
}
Limitations
ADS routers only allow a single connection from a host (i.e. a GEA device), and the Target AMS Net ID is ingrained in the connection configuration. This leads to a few important limitations to consider …
- Across all of its deployed workflows, if the GEA contains Beckhoff Triggers that connect to the same ADS router but different Target AMS Net IDs, only one of the triggers will successfully connect. The other triggers will not open a connection, and information about subscription failures will appear in the container logs.
- Similarly, if the device is running a Beckhoff Trigger and Beckhoff: Read Nodes and/or Beckhoff: Write Nodes that connect to the same ADS router but different Target AMS Net IDs, the Read / Write Nodes will fail and will return an error since the one client connection is being used by the Beckhoff Trigger.
Related Nodes
Was this page helpful?
Still looking for help? You can also search the Losant Forums or submit your question there.