Giter Club home page Giter Club logo

l5x's People

Contributors

jvalenzuela avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

l5x's Issues

UDT long dimension

Hello,

Seems doesn't work in case of UDT with big Dim 1 dimension.

Example
with MyTag with data type MyUDT[100] it works well :

prj.controller.tags['MyTag'][int(0)]['Member1'].value
returns
"17.5"

but if MyUDT[10000]
prj.controller.tags['MyTag'][int(0)]['Member1'].value
returns
"RuntimeError: Decoded data content not found for MyTag tag. Ensure Encode Source Protected Content option is disabled when saving L5X"

I'm sure that I have saving L5x without source protection..

Alias support

I have a need to change alias tags. Can something like ".alias" be added to the tag element? I'd like the ability to reference global scope and program scope. something like:
prj.controller.tags['global tag'].alias = prj.controller.tags['a different global tag'].name
OR
prj.programs['MainProgram'].tags['a_program_tag'].alias = prj.controller.tags['global tag'].name
prj.programs['MainProgram'].tags['a_program_tag'].alias = prj.programs['MainProgram'].tags['a_different_program_tag'].name

This would reference the "AliasFor" attribute. I would hope it checks the tag has the attribute TagType="Alias".

project export even with no changes is causing an issue

running the following code and then opening the l5x in designer is giving the errors below; i'll update with what I do to fix, but probably wont get into your code to figure out why this is happening

code:
prj = project.Project(fn) # where fn is some l5x file
def saveFile(saveIdx):
prj.write(controller + str(saveIdx) + 'AutoGen.L5X')
saveFile('NoEdits')

import errors:
Error: Line 60783: Required CDATA for element 'Line' was missing.
RSLogix5000Content/Controller/AddOnInstructionDefinitions/AddOnInstructionDefinition[@name="AOI_DaysSince"]/Routines/Routine[@name="Logic"]/STContent/Line[@Number="5"]
Error: Line 61646: Error creating 'LocalTag[@name="AOI_DaySince"]' (Data type does not exist.).
RSLogix5000Content/Controller/AddOnInstructionDefinitions/AddOnInstructionDefinition[@name="AOI_ISO_Weeknumber"]/LocalTags/LocalTag[@name="AOI_DaySince"]
Error: Line 72136: Required CDATA for element 'Line' was missing.
RSLogix5000Content/Controller/AddOnInstructionDefinitions/AddOnInstructionDefinition[@name="AOI_TIME_ADD"]/Routines/Routine[@name="Logic"]/STContent/Line[@Number="23"]
Error: Line 73468: Required CDATA for element 'Line' was missing.
RSLogix5000Content/Controller/AddOnInstructionDefinitions/AddOnInstructionDefinition[@name="AOI_TIME_DIFFERENCE"]/Routines/Routine[@name="Logic"]/STContent/Line[@Number="25"]
Error: Line 74626: Error creating 'LocalTag[@name="AOI_SNTP_Time_To_Current_Date"]' (Data type does not exist.).
RSLogix5000Content/Controller/AddOnInstructionDefinitions/AddOnInstructionDefinition[@name="AOI_SNTP_QUERY"]/LocalTags/LocalTag[@name="AOI_SNTP_Time_To_Current_Date"]
Error: Line 158502: Error creating 'Tag[@name="DSTAOIWeekNumMar"]' (Data type does not exist.).
RSLogix5000Content/Controller/Tags/Tag[@name="DSTAOIWeekNumMar"]
Error: Line 158564: Error creating 'Tag[@name="DSTAOIWeekNumNov"]' (Data type does not exist.).
RSLogix5000Content/Controller/Tags/Tag[@name="DSTAOIWeekNumNov"]
Error: Line 580186: Required CDATA for element 'Line' was missing.
RSLogix5000Content/Controller/Programs/Program[@name="FS_PCI"]/Routines/Routine[@name="R001_Init"]/STContent/Line[@Number="3"]
Error: Line 609113: Error creating 'Tag[@name="SNTP_AOI_TAG"]' (Data type does not exist.).
RSLogix5000Content/Controller/Programs/Program[@name="MainProgram"]/Tags/Tag[@name="SNTP_AOI_TAG"]

version attribute

I would like to be able to request the version programmatically. Ideally, using the __version__ attribute.

See pep 0396

Adding Tags

Are you able to add tags to the code by using this lib?

BOOL values

Add support/documentation/tests to permit BOOL tags to be assigned True/False values in addition to 0 or 1.

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

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.

tag name change

Hello! Is there any way to update the tag name? Thank you in advance!

Module names

Some modules have no name attribute, such as peripheral cards in a VFD. This causes a KeyErrror exception when accessing the modules name attribute.

DINT in binary "style"

We use UDTs that have DINTs formatted in binary style. It's stupid, and I'll be changing the UDTs going forward because it's also causing issues for my other forms of automation as well.

However, the library expects a dint to be a base 10 number (which makes sense) but that's not what I get.

My code:

import l5x

prj = l5x.Project('FILENAME.L5X')

# for tag in prj.controller.tags:
#     print(tag)
# print(prj.controller.tags.names)
names = prj.controller.tags.names

for name in names:
    print(name)
    print(prj.controller.tags[name].data_type)
    print(prj.controller.tags[name].description)
    print(prj.controller.tags[name].value)

with output:

Traceback (most recent call last):
  File "c:\VMs\SharedFilesBetweenVMs\l5x testing\test.py", line 15, in <module>
    print(prj.controller.tags[name].value)
  File "C:\Users\Wes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\l5x\tag.py", line 31, in __get__
    return getattr(tag.data, self.attr)
  File "C:\Users\Wes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\l5x\tag.py", line 519, in __get__
    return dict(zip(member_names, [struct[m].value for m in member_names]))
  File "C:\Users\Wes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\l5x\tag.py", line 519, in <listcomp>
    return dict(zip(member_names, [struct[m].value for m in member_names]))
  File "C:\Users\Wes\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\l5x\tag.py", line 372, in __get__
    return int(instance.element.attrib['Value'])
ValueError: invalid literal for int() with base 10: '2#0000_0001_1110_0000_0000_1010_0000_0000'

Port NAT address & SNN

Request to add access to communication port NAT address and SNN:

class Port(ElementAccess):
    """Accessor object for a module's port."""
    address = AttributeDescriptor('Address')
    type = AttributeDescriptor('Type', True)
    snn = SafetyNetworkNumber()
    nat = AttributeDescriptor('NATActualAddress')

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.