Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After automatic reconnection, tags are not readable and throw TIMEOUT error #63

Open
ryangriggs opened this issue Apr 27, 2024 · 1 comment

Comments

@ryangriggs
Copy link

ryangriggs commented Apr 27, 2024

May be related to Issue #56

Steps to reproduce:

  1. Connect to a CompactLogix PLC using:
const plc = new Controller()
plc.connect(ip_address, slot);

(At this point the plc.established property changes to true to indicate an active connection.)

  1. Wait a while and start reading tags repeatedly using plc.readTag()

  2. After tags are reading successfully, unplug the PLC's Ethernet cable, power it off, or change its' IP address, causing a loss of connectivity to the PLC.

  3. After a moment, the readTag() function starts to throw errors, and the plc.established property changes to false.

  4. Wait a few moments, then restore the PLC's connectivity.

  5. After a moment, the plc.established property turns to true again, indicating that the library has reconnected to the PLC. However, any subsequent attempts to execute plc.readTag() fail with the following error: (note that the tag being read in this example is named "Int1" and is a Controller-scoped tag.

All subsequent readTag() functions fail until a new plc.connect(...) function is issued, at which point everything starts reading again.

Error: TIMEOUT occurred while writing Reading Tag: Int1.
at Controller._readTag ([snip]\node_modules\st-ethernet-ip\dist\controller\index.js:727:28)
at TaskEasy._runTask ([snip]\node_modules\task-easy\src\index.js:118:9)
at TaskEasy._next ([snip]\node_modules\task-easy\src\index.js:138:18)
at [snip]\node_modules\task-easy\src\index.js:56:22
at new Promise (<anonymous>)
at TaskEasy.schedule ([snip]\node_modules\task-easy\src\index.js:51:16)\
at Controller.readTag ([snip]\node_modules\st-ethernet-ip\dist\controller\index.js:591:34
at Driver_EthernetIP.read ([snip]\Driver_EthernetIP.class.js:150:19)
 … …
@SerafinTech
Copy link
Owner

plc reconnections are not handled on the base class Controller. Use the extController or ControllerManager class or you can look at its code to see how disconnects are handled there to roll your own controller error handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants