dmroeder / pylogix

Read/Write data from Allen Bradley Compact/Control Logix PLC's
Apache License 2.0
599 stars 182 forks source link

Multi-Dimensional Arrays? #2

Closed brendonparker closed 8 years ago

brendonparker commented 8 years ago

First off, this is awesome! Big help to get me up and going.

Second, thanks for the rickroll.

Third, I'm trying to read a multi-dimensional array. Something like: MyTag.Data_Storage[0,0] but the code doesn't seem to parse the response very well. I'm digging in, but wondering if this is something you've had working and/or tested?

Thanks!

dmroeder commented 8 years ago

1) Thanks 2) I was wondering when someone would notice. Sorry for my immaturity 3) I have tested multi dimension arrays and they work for me. It appears that the member of the UDT has 2 dimensions, Logix doesn't allow me to do that. Could you send me the UDT you are using? Also, what version of Logix?

edit: v29 maybe?

brendonparker commented 8 years ago

See sent attachment for the UDT and the version: Studio 5000 V27

dmroeder commented 8 years ago

I must be terrible at this, I don't see an attachment.

brendonparker commented 8 years ago

Try this: https://dl.dropboxusercontent.com/u/15576660/UDT_DataStorage.L5X

dmroeder commented 8 years ago

Your tag doesn't appear to be multi-dimension. I don't think Logix allows you to even create multi-dimensions as a UDT member. In other words you cannot have a tag like you showed above (MyTag.Data_Storage[0,0]). When you look in your tag database, do you see your tag exactly how you described? If so I'd love to get a copy because I didn't think it was possible. You can declare an instance of a UDT multi-dimensional but you can't have multi-dimensional members.

I see you have two members of your type. DataStorage and DataStorage_Hold. Are you wanting to get values from both members at the same time? In other words you expecting to get "MyTag.DataStorage[0]" and "MyTag.DataStorage_Hold[0]" by attempting to read "MyTag.DataStorage[0,0]"?

brendonparker commented 8 years ago

FWIW the tag I am trying to read is BCS4201.Results[0,0]

dmroeder commented 8 years ago

Would it be possible to get a copy of the program? If you don't feel comfortable sharing it, could I at least get a copy of it stripped down to just that tag?

dmroeder commented 8 years ago

Is there something beyond .Result[0,0]. Maybe like .Result[0,0].DataStorage?

brendonparker commented 8 years ago

Thanks for quick replies. I figured it out. It was user error on my part. Although when I called two different array tags back to back I was getting an error, so that threw me off. Haven't had time to dig into that yet. Will let you know if that too is my error :P On Tue, Nov 22, 2016 at 4:44 PM dmroeder notifications@github.com wrote:

Is there something beyond .Result[0,0]. Maybe like .Result[0,0].DataStorage?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dmroeder/pylogix/issues/2#issuecomment-262374915, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8Xwg3cqVdziHVGd7XNke0v6YEc3Ljuks5rA2JTgaJpZM4K51uM .

dmroeder commented 8 years ago

Yeah no problem, thanks for getting back. If there really is an issue with reading tags back to back, get me some specifics and I'll test it. I do a lot of reading/writing of lots of different types and structures, maybe there is something that I haven't tried yet.

dmroeder commented 8 years ago

Since I didn't hear anything back, I'm closing the issue.