RSLogix .L5X interface.
Project description
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.
Getting Started
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')
Controller
The controller attribute of a project has the following attributes:
- tags:
A tag scope containing controller tags; see Tags.
- comm_path:
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'
- snn:
Safety network number; see Modules for details.
Programs
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
Modules
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[2].type 'Ethernet' >> prj.modules['ENBT'].ports[2].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'
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file l5x-1.3-py2.py3-none-any.whl.
File metadata
- Download URL: l5x-1.3-py2.py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bac8581e2cc6e2c309adac9f43ef9ddb83c0a5263d64a3d9400ced9b9a8eb1d2
|
|
| MD5 |
41a00c49ed82270541cac1752009b865
|
|
| BLAKE2b-256 |
78f7ef572735e88346f5f0f05704250e9332f0998e820f9ced16fdf78be4f8b1
|