Giter VIP home page Giter VIP logo

Comments (8)

dmroeder avatar dmroeder commented on July 29, 2024

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.

  1. 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.

snowwindwaverider avatar snowwindwaverider commented on July 29, 2024

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.

mos89 avatar mos89 commented on July 29, 2024

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.

dmroeder avatar dmroeder commented on July 29, 2024

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.

mos89 avatar mos89 commented on July 29, 2024

from pylogix.

dmroeder avatar dmroeder commented on July 29, 2024

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.

mos89 avatar mos89 commented on July 29, 2024

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.

dmroeder avatar dmroeder commented on July 29, 2024

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)

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.