Which Python Lib To Use?

Wow thats a crazy delay. In the siemens library I used. Snap7. It was as close to instant as I could expect. I was turning a bit on with the python program then flipping it off in the plc with a short timer and you would never even see it turn off. The whole process of reading --> writing --> reading would be <50ms

Yeah, I thought the same thing about the delay. If I recall, the delay was only when reading a tag value, not writing to it. Writing was fast, like <100ms. So not sure what the delay on reading is all about. There might be a function in that library that is more efficient and faster for reading. Again, I was only reading by tag name, and only one tag. I don't think it was anything on my end causing the delay(?). I'd be interested to know someone else's experience.

I've also used the pyads library for communicating with Beckhoff PLC's. That one is fast ("instant") for reading and writing to PLC variables. No issue with delays.
 
I've only recently started experimenting with using Python libraries with PLC's. I used Pycomm3 to communicate with ComplactLogix PLC. Very straight forward and easy. Documentation good and thorough. I was just reading tags and writing to them, so not doing anything compelling.

One thing I did find though that was odd, possibly just inherent to that library is that when reading just one tag, it would hang for several seconds before finally reading back the tag value. My guess is that the time delay is because it's iterating through all the tags on the controller to find the tag name specified(?). I didn't dig into the underlying code to find out, but just a guess.

I believe the delay in pycomm3 is because it retrieves the tag database the first time it connects to the PLC in order to have the UDT definitions ahead of time. There is no documented way to retrieve the structure of only one tag, it is all or nothing. So the larger your tag database is, the longer this takes.
 
Last edited:
You docs and programming examples are excellent. Thank you for all your hard work!

Thanks for the feedback. I added the docs recently, which I feel like I'm terrible at.

When I started learning python, I found that I learned best with simple examples that I could tinker with, to see how they work. Simple, clear examples are sometimes hard to come by, so I had all of that in mind when I added them to the project. I'd end up reading some projects documentation to try to understand how to use it, but it was good examples that really helped me.
 
Thanks for the feedback. I added the docs recently, which I feel like I'm terrible at.

When I started learning python, I found that I learned best with simple examples that I could tinker with, to see how they work. Simple, clear examples are sometimes hard to come by, so I had all of that in mind when I added them to the project. I'd end up reading some projects documentation to try to understand how to use it, but it was good examples that really helped me.

I agree completely as a novice python programmer. I find examples that are either way to complicated for me to understand. Or in the case of the snap7 lib. I had amazing docs, but no examples so it was a little tricky to figure the structure out. I probably miss alot of stuff that is "assumed" by someone more experienced.
 
I'm unfamiliar with Omron, what protocols do your PLC's support? You seem to be referencing software rather than hardware. There are modbus libraries if they support modbus.
 
Github is usually my first stop for this kind of thing. Maybe summat here? But I'd be surprised if @dmroeder's modbus suggestion does not pan out.

Omron generally has Ethernet IP, FINS, and ETHERCAT. I dont know if their ethernet IP protocol is really the same as AB because they have their own version of EDS files that are different. I am going to do some hunting on github
 

Similar Topics

Hello Guys, I want to establish profinet communication between siemens plc and my system using python programming. Which python lib can i use to...
Replies
12
Views
287
Hi! I'm trying to communicate with an old Kinetix 300 drive that is fully functioning. Is there any library I can use to monitor this drive with...
Replies
0
Views
419
Hi! I'm trying to communicate with an old Kinetix 300 drive that is fully functioning. Is there any library I can use to monitor this drive with...
Replies
0
Views
476
I have previously shared this elsewhere, so I apologize if you have already seen it. Here is a basic and quick introduction to Python for PLCs...
Replies
10
Views
2,231
Read and write the Tags direct using pycomm3 and LogixDriver. Just in case anybody wanted to know. Here's a sample: from pycomm3 import...
Replies
0
Views
787
Back
Top Bottom