Receiving (not pulling or writing) data from AB Compact GuardLogix PLC #177
Replies: 3 comments 1 reply
-
Pylogix does not have "listener" functionality. As for pycomm3, I'm not involved with that project, you'd have to ask over there. Curious, what is it about this application that requires the PLC do the work? |
Beta Was this translation helpful? Give feedback.
-
So was the AB PLC programmed originally to send data to another AB PLC? Now your machine will be inserted into the system and will have to receive that data being sent? If this is true, how was the PLC sending the data? Producer/consumer or message (MSG)? It seems to me that if you can identify the tags where this data exists and you can identify when the data is intended to be sent, you could write something to read the data at the appropriate time. Let's say the data was being sent via MSG. Find what triggers the message and continuously read that logic. You could even monitor the MSG.EN bit to know when the message is being triggered. When you see it go true, read the tags that were contained in the message. No reprogramming required. In my view, the simple an correct way to do this is to read the data externally, not listen for the data. There would likely be a lot of work that would go into this listener idea, way more work than writing something to do the reading from your Pi. |
Beta Was this translation helpful? Give feedback.
-
Are you saying that you want the PLC to act as a publisher, and the pi as a subscriber? If, so yeah you'll need to make PLC changes so that it has a bit that says hey I am publishing data, there's no other way around that if you're using pylogix, I don't mess with pycomm3 so not sure. Now if you can't modify the PLC program, the next best thing would be to make a fake publishing program on the pi. Say you read 10 tags at 50ms, you keep the last read in memory something like redis. On the next read you compare the latest data to the in memory read. If N tag is the same, then no need to broadcast any changes, if one tag change then broadcast to all your subscribers. Imo this would be far easier to do on the pi, than the PLC but that's just me. |
Beta Was this translation helpful? Give feedback.
-
Hello,
We are trying to RECEIVE data from a AB Compact GuardLogix PLC over ethernet IP.
Most examples of pylogix (or similar libraries like pycomm3) usage shows that the communication always initiates from the host computer running python script(a raspberry pi, for example), it either pulls or writes data from or to a PLC.
This does not apply for our application.
We need to receive data from a already programmed Compact GuardLogix PLC to read 5/6 different tags sent ~every minute.
It seems like we need to have some sort of listener running on the pi to listen to incoming data from the PLC over ethernet IP.
Is this something we can do using pycomm3? If not, can anyone please point me to the right direction?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions