Comments (8)
Sorry for the long delay, I've been away from a computer for a bit.
First, there has never really been any intention to read the entire contents of a UDT. I recently added the ability to get the UDT name with GetTagList() but didn't really plan on taking that much farther.
B) A STRING is a "struct" just like a TIMER, COUNTER or UDT. Essentially anything but the base data types is a "struct" (160). STRING though has an identifier that tells me that although it is a struct, it happens to be the standard STRING type so I know how to parse it. If you try to read a UDT, TIMER, custom string type, etc, there isn't currently a way to tell the difference.
- I could make a change so that when you try to read a UDT, it will just return the array of bytes and you'll have to understand how it is packed and unpack it yourself. I have proposed this to a few other users but nobody tends to respond when I suggest it. It's probably the way it should be anyway.
Hopefully I didn't get too far off course there about the string/struct stuff, it's been a while since I've had to dig into that so it's possible that that part of my memory got swapped out with some other nonsense :)
from pylogix.
In the end the way for me to go was to parse the program l5x file so I know the structure of the UDTs and then read the members one by one. I ran in to problems with the Rockwell Library Of Process Objects (PAX) AOI defined types by trying to read them since some of the local tags have external access set to None.
Thanks for your efforts in making pylogix! it is very handy to be able to pull the data out of the PLC without setting up an HMI software.
from pylogix.
hi is it possible to read a tag with a custom UDT and it will return the array of byte which can be cast to retrieve the data ?
from pylogix.
Hello mos89, it is possible to read the values of a UDT with a few caveats. The reply needs to fit into 1 packet, so large UDT's probably won't work. It's up to you to parse the reply. In order to do it, you need to know the exact structure of the UDT, the order that the values will be coming in and the number of bytes of each value.
Regarding the idea of it fitting in 1 packet, I recently added the large forward open, so using ConnectionSize, you can increase the packet size to 4000 bytes. Of course, your processor has to support that feature.
Example 40_read_timer.py is an example of reading a structure. The same idea will apply to any UDT. If you give me details of the UDT (maybe the export of it), I might be able to help you if you need it.
from pylogix.
from pylogix.
I did not see an attachment of your UDT. What I think most users do when dealing with UDT's it to export your UDT to a L5X/L5K, then write a script to get the makeup of the UDT, which then can be used to read the tags. The more complex the UDT, the harder this gets. I'm working on an example of doing this which I'll push to the project as I get time.
from pylogix.
I did not see an attachment of your UDT. What I think most users do when dealing with UDT's it to export your UDT to a L5X/L5K, then write a script to get the makeup of the UDT, which then can be used to read the tags. The more complex the UDT, the harder this gets. I'm working on an example of doing this which I'll push to the project as I get time.
Hi
i try a new link for the attachment
https://wetransfer.com/downloads/e36ed8a1558130fbbc3cbbf16c7cd51920190517130318/25547cd4547245f08ec5404966903a9920190517130318/6862f6
Doc_UDT.docx
from pylogix.
LOL, that is a giant UDT. I can't do much with a word document though.
First of all, it doesn't show me the entire structure. Second, for me to write something to parse it, I would need the L5X export, even if your word document showed the entire structure of your ~30kb UDT, I'm not going to sit here and recreate it myself.
If you can get me the actual L5X export of the entire UDT, depending on how much work it will be, I may be able to help you out. Otherwise, you might just have to settle with an example of parsing a L5X and work it out for your UDT. If there is something about your UDT that you don't want to share publicly, feel free to email it directly to me (see setup.py).
from pylogix.
Related Issues (20)
- "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
- PLC connection best practice HOT 8
- Forward Open Failed HOT 22
- Connection Issues HOT 9
- PLC read does not run when called from a function HOT 5
- documentation on the CIP protocol HOT 8
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.