Opclib

I found myself in need of an OPC library to read/write values from a PLC controlled machine. The PLC in question are Allen Bradley Control-logix. When looking around at how this is done, I came across OPC. The basic outline I discovered was that I needed an OPC gateway (like Kepware, Matrikon, etc) that could communicate with the PLC controllers and then would need a way to communicate with the gateway from an external Python 3 program.

As I researched more, I found a library called OpenOPC. This library allowed me to do some testing of the concepts I had researched. The problem that I ran into was that it was only Python 2. Porting the library was not very difficult so, I went ahead with making some small changes to enable it to run on Python 3.

After establishing both read and write access using OpenOPC and diving into the source quite a bit, I decided that it would not really be that difficult to just write a simple library that would have the behavior that I would like. I have placed the library up on Bitbucket-opclib for others that may have found themselves needing a similar library.