RSLogix .L5X interface.
This package aims to implement an interface for manipulating content of RSLogix .L5X export files using a native Pythonic approach as opposed to dealing with raw XML.
All access to .L5X data is through a top-level Project object, instantiated by passing a filename to the constructor. If the project is to be modified the write method writes the updated data back to a file for importing into RSLogix. Typical execution flow is as follows:
import l5x prj = l5x.Project('project.L5X') # Read or modify data as needed. prj.write('modified.L5X')
The controller attribute of a project has the following attributes:
- A tag scope containing controller tags; see Tags.
- Permits reading and modifying the controller’s communication path. Setting to None will delete the communication path.
>>> prj.controller.tags['tag_name'].description = 'A controller tag' >>> prj.controller.comm_path 'AB_ETHIP-1\\192.168.1.10\\Backplane\\0'
- Safety network number; see Modules for details.
A project’s programs attribute contains a names attribute that evaluates to an iterable of program names, members of which can be used as indices to access program-scoped tags.
>>> prj.programs.names ['MainProgram', 'AnotherProgram'] >>> prj.programs['MainProgram'].tags['a_program_tag'].value = 50
The project’s modules attribute provides access to modules defined in the I/O Configuration tree. A list of modules can be obtained with the names attribute.
>> prj.modules.names ['Controller', 'DOUT1', 'ENBT']
Each module is comprised of a set of communication ports identified by a unique integer. Ports feature a read-only type attribute to query the interface type and a read-write address attribute to get or set the type-specific address. A typical example for manipulating the IP address of an Ethernet port, which is usually port 2:
>> prj.modules['ENBT'].ports.type 'Ethernet' >> prj.modules['ENBT'].ports.address = '192.168.0.1'
Safety modules, including the controller, contain a read/write snn attribute for manipulating the module’s safety network number. It evaluates to a 12-character string representing the hexadecimal safety network number; intervening underscores as seen with RSLogix are stripped away. Acceptable values to set a new number need not be zero padded and may contain intervening underscores, however, it must be a string yielding a hexadecimal number not exceeding 48 bits.
>>> prj.controller.snn '000011112222' >>> prj.modules['safe_in'].snn 'AAAABBBBCCCC' >>> prj.controller.snn = '42' >>> prj.modules['safe_out'].snn = '0001_0002_0003'
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|l5x-1.2-py2.py3-none-any.whl (28.2 kB) Copy SHA256 hash SHA256||Wheel||2.7||Aug 26, 2016|
|l5x-1.2-win32.exe (227.9 kB) Copy SHA256 hash SHA256||Windows Installer||any||Aug 24, 2016|