Code Monkey home page Code Monkey logo

Comments (4)

dmroeder avatar dmroeder commented on July 18, 2024

Can you explain what you mean by "doesn't work" when you try to do what is in your second picture? I tried exactly that and it reads just fine.

Whether you could actually get 1000 reads per second reading individual tags will depend on your controller. If it isn't the newer architecture controllers (5380/5580) with the gigabit ports, you won't be able to get that performance.

Utilizing lists of tags with read will get you better performance since you are packing more data per packet. Of course you have to watch how many tags you attempt to read at a time (as you mentioned).

Providing the data type with the list of tags (tuple/list of list) will get you even better performance since it will pack more tags in a single packet as well as eliminate retrieving the data type of each tag.

For the best performance, map everything into an array of DINT's (for example) and read the entire array.

from pylogix.

dmroeder avatar dmroeder commented on July 18, 2024

I should also add you should move your reads into the "with" indent.
Also, don't print the results

from pylogix.

TheFern2 avatar TheFern2 commented on July 18, 2024

Even if your controller can handle it, and your network setup I wouldn't recommend reading that many tags per second, you can overload the comms % usage and interrupt communications for important stuff like HMI communications and controls logic. Go on a browser enter controller IP, and go under tasks to see if there is any high percentage on communications. I've actually seen systems with L73 where the cpu can't handle any more comms, and doing something so high performance like you are looking for can have negative effects on the system. It is worth mentioning on old controller version 20 and below there was a Task Monitor tool which was in my opinion much better than web gui info.

from pylogix.

kyle-github avatar kyle-github commented on July 18, 2024

Oops, missed this the first time around.

What @kodaman2 said. Reading that many individual tags is going to kill your PLC if you try to do it one read at a time. I am not sure about pylogix, but I have done it with my library as a stress test. That uses a lot of internal async handling with multiple partial requests in flight and absolutely requires multiple request packing and large packets (AB allows you to negotiate up to 4000-byte packets). I've done up to 1000 DINT tags at a time, but it is really hammering the PLC! Not recommended.

Using boolean arrays is almost always an anti-pattern in AB logic. Reading them is a pain and the code in the PLC is a lot slower. Use single bits in DINTs.

If you are trying to read that many tags individually, I strongly suggest copying them to a DINT array in the PLC itself and reading the whole array as a single tag. Be aware that the network IO and the PLC scan are not synchronized with respect to each other. So if you are writing these bits all out in a row in some PLC program, your tag read can get a partially updated array. We use sentinel values at the beginning and end of each such array to determine if we got a clean read. It breaks far more often than you would think.

from pylogix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.