I'm looking for a simple way, if that's even possible, to make an app that can read/write to tags in a ROCKWELL PLC.
What I need is a simple window that allows me to type the PLC IP (they are all connected to the network) so I can connect to the device, a container that loads all the PLC current tags, and the ability to read and/or write to those tags.
I consider myself a beginner when it comes to PLC and Java programming, so I would like to know if guys can assist me somehow. I said JAVA because it's the programming language that I know a little, but it doesn't matter if there's another one that is better to use, like VBA.
The GUI isn't really the issue here, but to connect to the device and manipulate it's variables.
I am a little late to the party but there is a new library https://github.com/dmroeder/pylogix that is very promising. I have written a few web apps apps with it and it is very easy to use. From the docs:
Reading a tag is as simple as (from the examples):
If you know the Tag names in the Rockwell ControlLogix PLC, you can quickly read and write their values from a Python program (from Windows, Mac or Linux hosts), using https://github.com/pjkundert/cpppo. To install it, run, install Python 2 or 3, and run:
Lets assume that your Rockwell ControlLogix PLC is at domain name "controller" in your local network (or, just use its IP address in
host = "192.168.1.2"
below), and that it contains a Tag namedscada
containing an array of 11 or more elements of CIP type INT:Assuming that the Tag
scada
exists, you'll see something like:If you don't have a Rockwell ControlLogix PLC around, you can simulate one (for the purposes of reading/writing Tag data, at least), by running:
Here you can find a librairy which will allow you to communicate with a Rockwell PLC. (look at TuxPLC for more detail --> documentation is in french)
Here you will find an adaptation of TuxPLC in python (which is very simple to understand if you are a beginner)
https://github.com/gaynertechnical/python-tuxeip
Example of reading then writing data in PLC (Be carefull when you proceed to you test) Read carefully the documentation in TuxEip folder ( https://github.com/leicht/TuxPLC )
I am familiar with two useful libraries in Python that allow connection to a PLC with tag writing and reading. They both work well and I have tried them out.
OpenOPC allows connection, tag reading and writing in a short Python program. It is best for Rockwell, assuming that you have Rockwell's RSLinx program running in the background to give your OPC server - make sure you use the same OPC topic to address tags in the PLC as what you set up on RSLinx. You will end up with something like:
If for some reason you can't use RSLinx, there's another way to do it in Python using pycomm:
Hope this helps - I know you'd prefer an answer in Java, but Python is what I've done this with before. Hopefully someone else can come along with a Java-specific answer.