Comments (12)
I need to read 300 tags and write to 500 tags in one step. This means the read takes 3 s and the write close to 10 s. These are individual tags (input and output tags) not part of an internal PLC tag array.
Thank you
from pylogix.
This is a Rockwell PLC
from pylogix.
That is definitely possible when reading/writing unique tags each time.
When a tag is accessed for the first time, 2 exchanges happen. First, the data type is requested, then the value is requested. Once the data type is known, we can just request the the value. This adds a little overhead when the tag is read for the first time. Doing this makes it easier on the user because they don't have to specify the data type up front.
In my tests, 20ms is a bit high, I get around 9 or 10 ms on the first read (which would be every read for you). I'm typically testing on a wireless network, you may get a little better performance when using a wired connection.
Out of curiosity, what is the specific part number of the PLC you are working with?
from pylogix.
from pylogix.
Thanks for the feedback, I'll look into your results.
Have you tried grouping your tags in lists to read? For example:
tagGroup1 = ['tag1', 'tag2', 'tag3', 'tag4']
values = test.Read(tagGroup1)
This would save you some time with each read. For now, you just need to ensure that you don't exceed the ~500 byte packet limit. This doesn't help you with writes though, but will cut some time with the reads.
from pylogix.
Ok, I did some quick testing. I used wireshark to measure times. I was testing over a wireless network.
1000 individual reads of unique tags took ~14 seconds
breaking up the 1000 tags in to lists of 10 tags and reading the lists took ~8 seconds
edit: For my threads, I did 10 threads, each reading 100 individual tags, it took ~3 seconds.
Regarding reading individual tags and using your suggestion on FastRead made no difference for me, as I would have expected, removing those ~12 lines of code would be irrelevant in CPU time scale.
from pylogix.
from pylogix.
The 500 byte limit is in the CIP specification for this type of data exchange. I think some controllers can support larger packets, but I wanted to stick with what any controller would support.
Mapping the tags to an array is definitely a good way to get the time down. I should have mentioned that option first, a lot of people don't like modifying their PLC programs though (understandably).
The reason working with arrays is a lot faster is because you send one packet to get the data type of the tag, then one request for the values, the controller responds with however many packets it takes to get the values to you. You can fit quite a bit of information in a packet, so there are far fewer socket exchanges. Run wireshark and compare the difference.
I was thinking that I may be able to make a change where you could specify the data type up front and save the time it takes to request the data type.
from pylogix.
from pylogix.
I finally pushed a change today that allows you to specify the data type when reading/writing. This will eliminate the request for the data type the first time a unique tag is read. It is an optional parameter and technically only needs to be provided on the first read of the tag (though it can be specified any read after without issue).
from pylogix.
from pylogix.
Yeah I did catch that. Putting the data into arrays and reading/writing is the most efficient. I ended up making the change anyway since there are people that may not have the luxury of being able to do what you did.
Dealing with arrays will still be much faster than utilizing the change that I made.
from pylogix.
Related Issues (20)
- Unknown Error 255 on Multi-Write when including a string HOT 6
- read tag from 80 sets of plc HOT 22
- Double read packets? HOT 6
- cannot import name 'Adapter' from 'pylogix' HOT 23
- Tag Write falsely reports Success HOT 7
- "Forward open failed" when trying to read tags from Berghof PLC HOT 8
- .GetDeviceProperties always returns DeviceType of "None" HOT 5
- Issues connecting to emulate HOT 7
- micro850 connection HOT 5
- Return data gets jumbled up on a multi write when the tags don't exist. HOT 13
- The return value is different when using a multi write compared to a single write for a string. HOT 4
- cannot get a tag list HOT 3
- Is it possible to inhibit a periodic task? HOT 2
- pylogix - returning a tag list as a row of values HOT 7
- PLC REAL values HOT 5
- Pylogix - compare a previously acquired tag list with the current one HOT 5
- Discover does not work while running pylogix in docker HOT 10
- Invalid Continuation Byte HOT 5
- Abnormal code termination. HOT 8
- Do I need to use routing? HOT 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylogix.