plcpeople / nodepccc

Library for node.js to communicate with some Allen-Bradley programmable controllers (PLCs)
MIT License
81 stars 24 forks source link

WIP: Implements reading ability for PLC-5 #33

Open gfcittolin opened 4 years ago

gfcittolin commented 4 years ago

This branch implements the ability to read (and maybe write in the future) data from/to PLC-5 and PLC-5/250 series of PLCs. It does so by implementing the PLC-5 command set, and allowing it to be chosen at constructor time, enabling further command sets to be developed. It defaults although to the existing SLC command set, so backwards compatibility is maintained.

This is still a Work In Progress: It has been only tested with a couple of tags against a single PLC, so more testing is very welcome in case anybody has access to such PLCs.

gfcittolin commented 4 years ago

My idea with the draft PR was to inform about the development, and allow anyone that has access to a PLC-5 (and is watching this repo) to be able to test on their systems and report any possible issue. I wouldn't merge it yet, as I've tested with a single CPU and just a couple of tags. The docs are also not much clear about the meaning of some fields, another reason to test it better before merging.

It would also be nice to implement the writing command as well before merging, or at least fail gracefully instead of just sending the same wrong command, the current behavior.

Do the response packets from the PLC-5 look identical, at least in your testing?

Luckily yes, at least according to the docs and for the couple tags I've tested. Again, more testing could expose some edge cases I'm not aware of.

Regarding the docs, I agree we need to update them, adding an example of the new option and the supported PLCs. As I'll still do some changes to the code, I can change the docs too.

Thanks for your time reviewing the code!