l5x icon indicating copy to clipboard operation
l5x copied to clipboard

Not able to access data stored in REAL type tag array.

Open jaewing opened this issue 1 year ago • 2 comments

Hi all,

Looking for help to resolve the following issue that I have encountered. In Studio 5000 I am able to see that "Data_1" tag array exists and contains the value 69 at the index "1". The recommendation to "Ensure Encode Source Protected Content is disabled when saving L5X" I have been unable to follow because that option is check and grayed out in every menu I have found it. This could be an issue of me not understanding where to look to be able to disable this option, but have been unsuccessful in finding a solution so far.

Other research/feedback I have gotten is that if the content isn't protected, it shouldn't matter. I am not aware of how to determine if the content is protected or not as the guides I have found have been for much older RSLogix versions of the software. I am currently running v28.03.00 of Studio 5000.

To my best knowledge I have tried everything recommended on the README. Any support would be greatly appreciated!

image

Traceback (most recent call last): File "C:\Git\AP4-PowerNet-Test-Bench-Script\main.py", line 121, in <module> print(prj.controller.tags['Data_1'][1].value) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ File "C:\Users\jaewing\AppData\Local\anaconda3\envs\AP4_Test_Bench\Lib\site-packages\l5x\dom.py", line 294, in __getitem__ return self.create_value_object(element) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jaewing\AppData\Local\anaconda3\envs\AP4_Test_Bench\Lib\site-packages\l5x\dom.py", line 304, in create_value_object return self.value_type(*args) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jaewing\AppData\Local\anaconda3\envs\AP4_Test_Bench\Lib\site-packages\l5x\tag.py", line 100, in __init__ self.data = data_class(self.get_data_element(), self) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jaewing\AppData\Local\anaconda3\envs\AP4_Test_Bench\Lib\site-packages\l5x\tag.py", line 112, in get_data_element raise RuntimeError("Decoded data content not found for {0} tag. " RuntimeError: Decoded data content not found for Data_1 tag. Ensure Encode Source Protected Content option is disabled when saving L5X.

jaewing avatar Aug 28 '23 19:08 jaewing

This is most likely caused by the size of the array. For some silly reason RSLogix will not export formatted data for tags that exceed some weird size limit; see issue #8. Ya, it's stupid.

I'm working on switching over to raw tag data, which is always present, instead of formatted to resolve this and other related issues.

jvalenzuela avatar Aug 29 '23 10:08 jvalenzuela

Thank you @jvalenzuela for replying! Because of the info you provided I was able to determine the maximum single Tag Array sizes for REAL and INT. For INT tag array type, you can have a maximum dimension of 51200. For REAL you can have a maximum dimension of 27500. With those dimensions I was able to write/read to the tag arrays with my script. It is definitely odd to me that it lets you read/write to multiple INT tag arrays of 51200 in length but not to a single INT tag array longer than 51200. Very curious!

jaewing avatar Sep 05 '23 22:09 jaewing