Giter VIP home page Giter VIP logo

jisotalo / node-red-contrib-ads-client Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 4.0 55 KB

Beckhoff TwinCAT ADS client library for Node-RED (unofficial). Connects to Beckhoff TwinCAT automation systems using ADS protocol.

Home Page: https://flows.nodered.org/node/node-red-contrib-ads-client

License: MIT License

HTML 59.97% JavaScript 40.03%
61131-3 ads beckhoff client codesys iec-61131-3 node-red plc twincat twincat-ads twincat2 twincat3

node-red-contrib-ads-client's People

Contributors

hopperpop avatar jisotalo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-red-contrib-ads-client's Issues

Subscribe not working without input

When using the subscribe node without an input, it won't connect (local connection).

afbeelding

[{"id":"90f489bd.33574","type":"ads-client-subscribe","z":"89b5ac23.d7af08","connection":"1086b6ee.1f2791","variableName":"","cycleTime":"2000","mode":"cyclic","initialDelay":0,"retryInterval":"100","controlSubscription":true,"inputs":1,"x":220,"y":520,"wires":[["d23952a6.a80a"]]},{"id":"d23952a6.a80a","type":"debug","z":"89b5ac23.d7af08","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":620,"y":520,"wires":[]},{"id":"923427e4.2e241","type":"ads-client-subscribe","z":"89b5ac23.d7af08","connection":"1086b6ee.1f2791","variableName":"Drives.fbDriveCyl[1].xCylinder","cycleTime":"2000","mode":"cyclic","initialDelay":"2","retryInterval":"100","controlSubscription":false,"inputs":0,"x":280,"y":580,"wires":[["ad851bd7.2a57e"]]},{"id":"ad851bd7.2a57e","type":"debug","z":"89b5ac23.d7af08","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","x":620,"y":580,"wires":[]},{"id":"eaddaad6.14037","type":"inject","z":"89b5ac23.d7af08","name":"","topic":"Drives.fbDriveCyl[1].xCylinder","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":460,"wires":[["43a2bf4a.bef43"]]},{"id":"43a2bf4a.bef43","type":"change","z":"89b5ac23.d7af08","name":"","rules":[{"t":"set","p":"subscribe","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":460,"wires":[["90f489bd.33574"]]},{"id":"1086b6ee.1f2791","type":"ads-client-connection","z":"","targetAmsNetId":"localhost","targetAdsPort":"851","objectifyEnumerations":true,"convertDatesToJavascript":true,"readAndCacheSymbols":false,"readAndCacheDataTypes":false,"disableSymbolVersionMonitoring":false,"routerTcpPort":"","routerAddress":"","localAddress":"","localTcpPort":"","localAmsNetId":"","localAdsPort":"","timeoutDelay":"","hideConsoleWarnings":false,"autoReconnect":true,"reconnectInterval":"","checkStateInterval":"","connectionDownDelay":"","allowHalfOpen":false,"disableBigInt":false}]

Uncaught error

Getting uncaught errors (node-red-contrib-ads-client v1.2.0), which stops node-red. I'm not sure if it's a problem with the node or the ads-client lib. It always happens after "IO out--->". The TcSystem isn't running. Somehow it tries to subscribe to a variable, while it just made a disconnect call. Could be a race condition, but I still need to investigate further.

  ads-client setDebugging(): Debug level set to 3 +2s
  ads-client connect(): Starting to connect localhost:48898 +1ms
  ads-client connect(): Socket connection established to localhost:48898 +8ms
  ads-client:details _registerAdsPort(): Registering an ADS port from ADS router localhost:48898 +2s
  ads-client:details IO out ------> 8 bytes +1ms
  ads-client:details IO in  <------ 14 bytes +0ms
  ads-client:details _parseAmsTcpHeader(): Starting to parse AMS/TCP header +1ms
  ads-client:details _parseAmsTcpHeader(): AMS/TCP header parsed: { command: 4096, commandStr: 'AMS_TCP_PORT_CONNECT', dataLength: 8, data: <Buffer c0 a8 00 c2 01 01 61 a4> } +0ms
  ads-client:details _parseAmsHeader(): Starting to parse AMS header +1ms
  ads-client:details _parseAmsHeader(): No AMS header found +1ms
  ads-client:details _parseAdsData(): Starting to parse ADS data +2ms
  ads-client:details _parseAdsData(): No ADS data found +3ms
  ads-client:details _onAmsTcpPacketReceived(): A parsed AMS packet received with command 4096 +1ms
  ads-client:details _registerAdsPort(): ADS port registered, assigned AMS address is 192.168.0.194.1.1:42081 +6ms
  ads-client connect(): ADS port registered from router. We are 192.168.0.194.1.1:42081 +21ms
  ads-client:details readSystemManagerState(): Reading device system manager state +9ms
  ads-client:details _sendAdsCommand(): Sending an ads command ReadState (0 bytes): { amsTcp: { command: 0, commandStr: 'AMS_TCP_PORT_AMS_CMD' }, ams: { targetAmsNetId: '127.0.0.1.1.1', targetAdsPort: 10000, sourceAmsNetId: '192.168.0.194.1.1', sourceAdsPort: 42081, adsCommand: 4, adsCommandStr: 'ReadState', stateFlags: 4, stateFlagsStr: 'AdsCommand, Tcp, Request', dataLength: 0, errorCode: 0, invokeId: 0 }, ads: { rawData: <Buffer > } } +7ms
  ads-client:details _createAmsHeader(): AMS header created (32 bytes) +12ms
  ads-client:details _createAmsTcpHeader(): AMS/TCP header created (6 bytes) +6ms
  ads-client:details _createAmsTcpRequest(): AMS/TCP request created (38 bytes) +0ms
  ads-client:details IO out ------> 38 bytes +6ms
  ads-client:details IO in  <------ 38 bytes +1ms
  ads-client:details _parseAmsTcpHeader(): Starting to parse AMS/TCP header +2ms
  ads-client:details _parseAmsTcpHeader(): AMS/TCP header parsed: { command: 0, commandStr: 'AMS_TCP_PORT_AMS_CMD', dataLength: 32 } +2ms
  ads-client:details _parseAmsHeader(): Starting to parse AMS header +0ms
  ads-client:details _parseAmsHeader(): AMS header parsed: { targetAmsNetId: '192.168.0.194.1.1', targetAdsPort: 42081, sourceAmsNetId: '127.0.0.1.1.1', sourceAdsPort: 10000, adsCommand: 4, adsCommandStr: 'ReadState', stateFlags: 5, stateFlagsStr: 'Response, AdsCommand, Tcp', dataLength: 0, errorCode: 18, invokeId: 0, error: true, errorStr: 'Port disabled' } +4ms
  ads-client:details _onAmsTcpPacketReceived(): A parsed AMS packet received with command 0 +1ms
  ads-client:details _onAdsCommandReceived(): A parsed ADS command received with command 4 +1ms
  ads-client:details _sendAdsCommand(): Response received for command ReadState with invokeId 0 +2ms
  ads-client readSystemManagerState(): Device system manager state read failed +50ms
  ads-client disconnect(): Starting to close connection (force: false) +3ms
  ads-client unsubscribeAll(): Unsubscribing from all notifications +3ms
  ads-client unsubscribeAll(): Unsubscribed from 0 notifications +0ms
  ads-client _unsubscribeAllInternals(): Unsubscribing from all notifications +3ms
  ads-client _unsubscribeAllInternals(): Unsubscribed from 0 notifications +2ms
  ads-client:details _unregisterAdsPort(): Unregister ads port 42081 from localhost:48898 +12ms
  ads-client:details IO out ------> 8 bytes +1ms
  ads-client subscribe(): Subscribing to MAIN.lrDt +3ms
  ads-client:details _subscribe(): Subscribing to 'MAIN.lrDt' with settings { transmissionMode: 4, cycleTime: 200, maximumDelay: 0 } +4ms
  ads-client getSymbolInfo(): Symbol info requested for MAIN.lrDt +3ms
  ads-client:details _readSymbolInfo(): Reading symbol info for MAIN.lrDt +1ms
  ads-client:details _sendAdsCommand(): Sending an ads command ReadWrite (26 bytes): { amsTcp: { command: 0, commandStr: 'AMS_TCP_PORT_AMS_CMD' }, ams: { targetAmsNetId: '127.0.0.1.1.1', targetAdsPort: '851', sourceAmsNetId: '192.168.0.194.1.1', sourceAdsPort: 42081, adsCommand: 9, adsCommandStr: 'ReadWrite', stateFlags: 4, stateFlagsStr: 'AdsCommand, Tcp, Request', dataLength: 26, errorCode: 0, invokeId: 1 }, ads: { rawData: <Buffer 09 f0 00 00 00 00 00 00 ff ff ff ff 0a 00 00 00 4d 41 49 4e 2e 6c 72 44 74 00> } } +11ms
  ads-client:details _createAmsHeader(): AMS header created (32 bytes) +0ms
  ads-client:details _createAmsTcpHeader(): AMS/TCP header created (6 bytes) +1ms
  ads-client:details _createAmsTcpRequest(): AMS/TCP request created (64 bytes) +1ms
  ads-client:details IO out ------> 64 bytes +1ms
1 Jul 17:21:56 - [red] Uncaught Exception:
1 Jul 17:21:56 - Error: read ECONNRESET
    at TCP.onStreamRead (internal/stream_base_commons.js:209:20)

Connection loop

Setup

  • Node-red on rpi with node-red-contrib-ads-client v1.2.0
  • TwinCat v4020.12 on win10 pc with static route pointing to 192.168.1.22

Config
image
image

Bug
As seen above the localAddress (who is a valid ethernet interface on the rpi) is set wrongly and doesn't match the static route on the win10 pc.

Node-red becomes unresponsive and eventually crashes. In the console following lines are spammed without delay:
ads-client: WARNING: Connection was lost. Trying to reconnect...,
ads-client: WARNING: Connection was lost. Trying to reconnect...,
ads-client: WARNING: Connection was lost. Trying to reconnect...,
ads-client: WARNING: Reconnecting failed. Keeping trying in the background every 5000 ms...,
ads-client: WARNING: Reconnecting failed. Keeping trying in the background every 5000 ms...,
ads-client: WARNING: Reconnecting failed. Keeping trying in the background every 5000 ms...,
ads-client: WARNING: Reconnecting failed. Keeping trying in the background every 5000 ms...,

problem with reconnection after redeployment

Hi,

I have a problem, that the Node-Red ads-client does not reconnect after a redeployment of Node-Red or after restart of the hardware. I use following Lib versions:

+-- [email protected] +-- [email protected] -> ./../../opt/nodered/lib/node_modules/node-red +-- [email protected] -> ./../../opt/npm/lib/node_modules/npm

and following Hardware: Advantech ICR3231 LTE-Router

Very strange behaviour:

I use a ADS - Connection Status node and several Subscribe nodes from the ads-client lib. After Deployment of the node-red flow, the ads nodes lose the connection to the Beckhoff PLC (TwinCAT 3).

Bevor deploy
image

After deploy
image

After I apply the ethernet settings in the advantech router, the ads node reconnect to the Beckhoff PLC.
image
image

Here is the Log of the process: (unfortuneatly with debug level 3 I get not more information)
`# tail -f module-nodered
{
fill: 'green',
shape: 'dot',
text: 'Subscribed',
source: {
id: '9f12b574bd018a50',
type: 'ads-client-subscribe',
name: 'FRONT_TIME_TOOL_CHANGE'
}
}
2023-06-29 16:22:36 [debug] saved flow revision: e392abca8ceadeb6cf067642057898cd
2023-06-29 16:22:36 [info] Stopping flows
2023-06-29 16:22:36 [debug] red/nodes/flows.stop : stopping flow : adbad0c8def14ca1
2023-06-29 16:22:36 [debug] red/nodes/flows.stop : stopping flow : 8ea35e728cd8dbf3
2023-06-29 16:22:36 [debug] red/nodes/flows.stop : stopping flow : 656dcc8b191c5056
2023-06-29 16:22:36 [debug] red/nodes/flows.stop : stopping flow : global
2023-06-29 16:22:36 [info] [ads-client-connection:41398cdf55542ea0] Disconnecting from 192.168.2.3.1.1:851 and unsubscribing from all...
2023-06-29 16:22:36 [info] [ads-client-connection:41398cdf55542ea0] Disconnected from 192.168.2.3.1.1:851
2023-06-29 16:22:36 [info] Stopped flows
2023-06-29 16:22:36 [info] Updated flows
2023-06-29 16:22:36 [info] Starting flows
2023-06-29 16:22:36 [debug] red/nodes/flows.start : starting flow : global
2023-06-29 16:22:36 [debug] red/nodes/flows.start : starting flow : adbad0c8def14ca1
2023-06-29 16:22:36 [debug] red/nodes/flows.start : starting flow : 8ea35e728cd8dbf3
2023-06-29 16:22:36 [debug] red/nodes/flows.start : starting flow : 656dcc8b191c5056
2023-06-29 16:22:36 [info] [ads-client-connection:41398cdf55542ea0] Connecting to 192.168.2.3.1.1:851...
2023-06-29 16:22:36 [info] Started flows
2023-06-29 16:22:37 [info] [mqtt-broker:hivemq] Connected to broker: mqtts://mqtt-broker.t-matix.io:8883
2023-06-29 16:22:37 [error] [file in:buffer_read] Error: ENOENT: no such file or directory, open '/var/data/node-red/mqtt_buffer'
2023-06-29 16:22:37 [debug] [exec:3c5f993fbf211703] rm /var/data/node-red/mqtt_buffer
2023-06-29 16:22:37 [debug] [exec:3c5f993fbf211703] error:Error: Command failed: rm /var/data/node-red/mqtt_buffer
rm: can't remove '/var/data/node-red/mqtt_buffer': No such file or directory

2023-06-29 16:22:38 [info] [ads-client-connection:41398cdf55542ea0] Connecting to 192.168.2.3.1.1:851 failed, keeping trying..
2023-06-29 16:22:38 [warn] [ads-client-connection:41398cdf55542ea0] Failed to connect 192.168.2.3.1.1:851 at startup: ClientException: Connection to 192.168.2.3:48898 failed (timeout) - No response from router in 2000 ms
2023-06-29 16:22:38 [error] [ads-client-subscribe:FRONT_TIME_TOOL_CHANGE] Error: Not connected to the target, retrying in the background.
2023-06-29 16:22:38 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Not connected',
source: {
id: 'd7afa6af1768a7a1',
type: 'ads-client-connection-status',
name: ''
}
}
2023-06-29 16:22:38 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected',
source: {
id: '9f12b574bd018a50',
type: 'ads-client-subscribe',
name: 'FRONT_TIME_TOOL_CHANGE'
}
}
2023-06-29 16:22:38 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected',
source: {
id: '2e4f302a8e8dd521',
type: 'ads-client-read-symbol',
name: 'FRONT_TIME_TOOL_CHANGE'
}
}
2023-06-29 16:22:38 [info] [debug:debug 5] ClientException: Connection to 192.168.2.3:48898 failed (timeout) - No response from router in 2000 ms
2023-06-29 16:22:38 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected, retrying...',
source: {
id: '9f12b574bd018a50',
type: 'ads-client-subscribe',
name: 'FRONT_TIME_TOOL_CHANGE'
}
}
2023-06-29 16:22:38 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected',
source: {
id: '6e48ed40dd6ff62c',
type: 'ads-client-read-symbol',
name: 'FRONT_SPINDLE_TOOL_CLAMPING'
}
}
2023-06-29 16:22:38 [info] [debug:debug 5] ClientException: Connection to 192.168.2.3:48898 failed (timeout) - No response from router in 2000 ms
2023-06-29 16:22:38 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected',
source: {
id: '4c31795556267fe2',
type: 'ads-client-read-symbol',
name: 'FRONT_SPINDLE_TOOL_RELEASE'
}
}
2023-06-29 16:22:38 [info] [debug:debug 5] ClientException: Connection to 192.168.2.3:48898 failed (timeout) - No response from router in 2000 ms
2023-06-29 16:22:38 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected',
source: {
id: '174fbeb06d4d43d4',
type: 'ads-client-read-symbol',
name: 'REAR_TIME_TOOL_CHANGE'
}
}
2023-06-29 16:22:38 [info] [debug:debug 5] ClientException: Connection to 192.168.2.3:48898 failed (timeout) - No response from router in 2000 ms
2023-06-29 16:22:38 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected',
source: {
id: 'e442289492c5f76b',
type: 'ads-client-read-symbol',
name: 'REAR_SPINDLE_TOOL_CLAMPING'
}
}
2023-06-29 16:22:38 [info] [debug:debug 5] ClientException: Connection to 192.168.2.3:48898 failed (timeout) - No response from router in 2000 ms
2023-06-29 16:22:38 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected',
source: {
id: '15ff5277958bb6d2',
type: 'ads-client-read-symbol',
name: 'REAR_SPINDLE_TOOL_RELEASE'
}
}
2023-06-29 16:22:38 [info] [debug:debug 5] ClientException: Connection to 192.168.2.3:48898 failed (timeout) - No response from router in 2000 ms
2023-06-29 16:22:42 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected, retrying...',
source: {
id: '9f12b574bd018a50',
type: 'ads-client-subscribe',
name: 'FRONT_TIME_TOOL_CHANGE'
}
}
2023-06-29 16:22:46 [info] [debug:debug 6]
{
fill: 'red',
shape: 'dot',
text: 'Error: Not connected, retrying...',
source: {
id: '9f12b574bd018a50',
type: 'ads-client-subscribe',
name: 'FRONT_TIME_TOOL_CHANGE'
}
}
2023-06-29 16:22:46 [error] [snmp:INFO] RequestTimedOutError: Request timed out
2023-06-29 16:22:49 [info] [debug:debug 6]
{
fill: 'green',
shape: 'dot',
text: 'Connected',
source: {
id: 'd7afa6af1768a7a1',
type: 'ads-client-connection-status',
name: ''
}
}
2023-06-29 16:22:49 [info] [debug:debug 6]
{
fill: 'green',
shape: 'dot',
text: 'Subscribed',
source: {
id: '9f12b574bd018a50',
type: 'ads-client-subscribe',
name: 'FRONT_TIME_TOOL_CHANGE'
}
}`

Thank you in advance!

Discussion of first versions

If you have any comments please add them here. I'm not sure if everything is done correctly (how things usually are done with Node-RED).

If you find bugs and other problems, please submit a new issue.

The library now has three nodes: Read Symbol, Write Symbol and Subscribe. Each one has it's own help inside the Node-RED so check it out.

Control subscribe node parameters with msg.subscribe

Hi, i have a feature request which would be an improvement and simplification for my use case, since i subscribe to many different variables and i would like to have a central way to control the cycle time instead of changing it in every node. Up to now it is only possible to control the subscribe node in a binary way (subscribe or don´t subscribe). It would be cool if you could inject a message with the parameters subscribtion mode, cycle time, initial delay and so on.

ClientException: Connection to localhost:48898 failed (socket error -4077) (read ECONNRESET)

Setup:

  • Node-red with node-red-contrib-ads-client v1.2.0
  • TwinCAT 3 4022.22 running on 64bit Windows 10 (remote PC & PLC)

I am getting a ClientExpection (see log below) when trying to set up notifications/subscriptions for a bunch of PLC variables:

Welcome to Node-RED
===================

5 Apr 12:39:56 - [info] Node-RED version: v2.2.2
5 Apr 12:39:56 - [info] Node.js  version: v16.14.0
5 Apr 12:39:56 - [info] Windows_NT 10.0.14393 x64 LE
5 Apr 12:39:57 - [info] Loading palette nodes
5 Apr 12:40:00 - [info] Dashboard version 3.1.6 started at /ui
5 Apr 12:40:00 - [info] Settings file  : C:\Users\User\.node-red\settings.js
5 Apr 12:40:00 - [info] Context store  : 'default' [module=memory]
5 Apr 12:40:00 - [info] User directory : \Users\User\.node-red
5 Apr 12:40:00 - [warn] Projects disabled : editorTheme.projects.enabled=false
5 Apr 12:40:00 - [info] Flows file     : \Users\User\.node-red\flows.json
5 Apr 12:40:01 - [info] Server now running at http://127.0.0.1:1880/
5 Apr 12:40:01 - [info] Starting flows
5 Apr 12:40:01 - [info] [ads-client-connection:MyPlcConn] Connecting to 172.17.3.23.1.1:851...
  ads-client _connect(): Starting to connect localhost:48898 +0ms
5 Apr 12:40:01 - [info] Started flows
  ads-client _connect(): Socket connection established to localhost:48898 +12ms
  ads-client _connect(): Socket connect failed: Error: read ECONNRESET
  ads-client     at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
  ads-client   errno: -4077,
  ads-client   code: 'ECONNRESET',
  ads-client   syscall: 'read'
  ads-client } +2ms
5 Apr 12:40:01 - [info] [ads-client-connection:MyPlcConn] Connecting to 172.17.3.23.1.1:851 failed, keeping trying..
5 Apr 12:40:01 - [warn] [ads-client-connection:MyPlcConn] Failed to connect 172.17.3.23.1.1:851 at startup: ClientException: Connection to localhost:48898 failed (socket error -4077) (read ECONNRESET)
  ads-client _disconnect(): Starting to close connection (force: false) +2s
  ads-client _unsubscribeAllInternals(): Unsubscribing from all notifications +1ms
  ads-client _unsubscribeAllInternals(): Unsubscribed from 0 notifications +1ms
  ads-client _registerAdsPort(): Failed to unregister ADS port - Timeout - no response in 2000 ms +2s
  ads-client _disconnect(): Connection closed successfully +2s
  ads-client setDebugging(): Debug level set to 2 +15ms
  ads-client _connect(): Starting to connect localhost:48898 +0ms
  ads-client _connect(): Socket connection established to localhost:48898 +6ms
  ads-client _connect(): Socket connect failed: Error: read ECONNRESET
  ads-client     at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
  ads-client   errno: -4077,
  ads-client   code: 'ECONNRESET',
  ads-client   syscall: 'read'
  ads-client } +8ms
5 Apr 12:40:07 - [info] [ads-client-connection:MyPlcConn] Connecting to 172.17.3.23.1.1:851...
  ads-client _disconnect(): Starting to close connection (force: false) +6ms
  ads-client _unsubscribeAllInternals(): Unsubscribing from all notifications +0ms
  ads-client _unsubscribeAllInternals(): Unsubscribed from 0 notifications +0ms
  ads-client _disconnect(): Connection closed successfully +2ms
  ads-client setDebugging(): Debug level set to 2 +1ms
  ads-client _connect(): Starting to connect localhost:48898 +0ms
  ads-client _connect(): Socket connection established to localhost:48898 +1ms
  ads-client _connect(): Socket connect failed: Error: read ECONNRESET
  ads-client     at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
  ads-client   errno: -4077,
  ads-client   code: 'ECONNRESET',
  ads-client   syscall: 'read'
  ads-client } +1ms
5 Apr 12:40:07 - [info] [ads-client-connection:MyPlcConn] Connecting to 172.17.3.23.1.1:851 failed, keeping trying..
5 Apr 12:40:07 - [error] [ads-client-subscribe:MyPlc] Error: Not connected to the target, retrying in the background.
  ads-client _disconnect(): Starting to close connection (force: false) +2s
  ads-client _unsubscribeAllInternals(): Unsubscribing from all notifications +1ms
  ads-client _unsubscribeAllInternals(): Unsubscribed from 0 notifications +0ms
  ads-client _registerAdsPort(): Failed to unregister ADS port - Timeout - no response in 2000 ms +2s
  ads-client _disconnect(): Connection closed successfully +0ms
  ads-client setDebugging(): Debug level set to 2 +0ms
  ads-client _connect(): Starting to connect localhost:48898 +0ms
  ads-client _connect(): Socket connection established to localhost:48898 +1ms
  ads-client _connect(): Socket connect failed: Error: read ECONNRESET
  ads-client     at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
  ads-client   errno: -4077,
  ads-client   code: 'ECONNRESET',
  ads-client   syscall: 'read'
  ads-client } +1ms

The route to the PLC is enabled and Ads Communication is already running successfully using .NET Software.
I experience this error trying to connect to a remote PLC (setup 1) as well as running Node-RED locally on the desired PLC (setup 4).
I also tried adding EnableAmsTcpLoopback = 1 as registry key on the remote PC as well the PLC without any success.

subscribe multiple

Question:

What if I have >200 individual variables and I want to subscribe to each one of them (preferably with individual settings for cycling time)? Do I need to create 200 individual subscription nodes? Or is there a possibility to use 1 node and subscribe to multiple variables (configured by the input msg for instance)
Does anyone have the same scenario? Suggestions on how to handle this efficiently?

Problem connecting to Beckhoff PLC

First of all I would like to thank you for this library! The examples and documentation is amazing!

Unfortunately I was not able to connect to my Beckhoff PLC. My task is to connect and take data from the PLC - I did not install it nor program it - so I don't know all the internal configuration etc. but I will try to explain our system as best as I can.

What am I using?

  1. Beckhoff PLC
  • type: CP-4D57D0
  • IP address: 172.21.9.60
  • AmsNetID: 5.77.87.208.1.1 OR 158.196.119.70.3.1 (see why I say OR down below)
  • ADS port: 851 OR 27907 (see why I say OR down below)
  1. Linux PC with Node-RED
  • IP address: 172.21.9.50
  • NodeRED verison: 3.0.2
  • contrib-ads-client version: 1.4.0

I enabled ADS and create symbols on the Beckhoff PLC as follow:
image

Why did I say AmsNET ID is 5.77.87.208.1.1 or 158.196.119.70.3.1?

  • I can see the AmsNET ID in two different places showing two different addresses.
  • And I don't know which one is correct
  • But I have tried both and both don't work.

One I can find here:
Screenshot_14

And second one I can see here:
Screenshot_8

The same applies for the PORTS 851 OR 27907

  • again I can see two diffrent ports in two diffrent places.
    Here:
    Screenshot_11

And here:
Screenshot_12

This is the error I am getting:
Screenshot_9

I do not understand why is it trying to connect to the local IP 127.0.0.1?
Shall I also configure something on my Linux PC?

I have tried every combination of AmsNetID and PORTS and none of the worked resulting in same error message (expect for the IP and PORT).

I will appreciate any help!
With regards,
Jakub Szlaur

Connection issues to CX8090 (Twincat2)

PLC: 192.168.11.3
AMSnetID PLC: 5.50.37.33.1.1
Twincat 2

Raspberry Pi : 192.168.11.2

Route has been created on PLC. Settings should be according tot tutorials

Error : "Failed to connect 5.50.37.33.1.1:801 at startup: ClientException: Connection failed: Device system manager state read failed - ADS error -1 (Timeout - no response in 6000 ms)"

image
image
image

no connection to Beckhoff PLC Simulation

Hi,

I have following problem with the ads-client in node-red (v3.0.2). I use an Advantech IoT Router ICR3231W with Node-Red installed. I have also installed the node-red-contrib-ads and the node-red-contrib-ads-client. My Beckhoff TwinCAT 3.1.0.0 (EventLoggerVersion: 4024.47) is installed on a Windows 10x64 Lenovo Notebook. Router and Notebook is connected via a Netgear unmanaged switch. Firewall is disabled on both sides. At the TwinCAT ADS Router I have configured a route to my Node-Red

With the node-red-contrib-ads lib it was possible to get a connection to the PLC via the ADS System node. I was also able to read global variables from the PLC Simulation. I have configured the node as followed:
image

With the node-red-contrib-ads-client I am not able to get a connection to the PLC SIM. I use the ADS - Connection Status node.

image

image

Why is it working with the node-red-contrib-ads but not with the node-red-contrib-ads-client. When I started testing with the node-red-contrib-ads-client I have restarted the PLC Sim, restarted the Router where Node-Red is running on and deleted the configuration from the node-red-contrib-ads in Node-Red.

Thank you in advance!
Kind Regards,
Patrick

Real number in PLC but INT in node-red

I declared the subscribed variable as a REAL output variable in TwinCAT 3. When i read it with the subscribe node i only get an INT value (without the decimal places) when i use the debug node.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.