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'
Ports configured for network address translation(NAT) can access the NAT address through the nat_address attribute. NAT addresses can only be read or altered by the L5X module, not enabled or disabled. In other words, the port must first be configured for NAT by RSLogix before the NAT address can be accessed, and the L5X module can not be used to disable NAT.
>> prj.modules['no_nat'].ports[2].nat_address # NAT not configured. None >> prj.modules['ENBT'].ports[2].nat_address '10.0.0.1' >> prj.modules['ENBT'].ports[2].nat_address = '192.168.0.1'
A module’s connection inhibit selection can be read or altered with the inhibit attribute:
>> prj.modules['ENBT'].inhibited False >> prj.modules['ENBT'].inhibited = True
Safety Network Numbers
Safety network numbers for safety modules, including the controller, can be accessed via the snn attribute of either the module or its ports. For modules with a single safety network number, such as safety I/O modules, the snn is an attribute of the module itself. Safety modules with multiple communication ports, such as controllers with integrated Ethernet ports, have multiple safety network numbers, which are attributes of its ports.
Module and port safety network numbers use the same format: a twelve 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 # Controller with a single SNN. '000011112222' >>> prj.controller.ports[0].snn # Controller with multiple, port-specific SNNs. '0123456789AB' >>> 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 Distribution
Built Distribution
File details
Details for the file l5x-1.6.tar.gz
.
File metadata
- Download URL: l5x-1.6.tar.gz
- Upload date:
- Size: 51.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 685cef8771425a2a4a1559e144ab76e435d2a41c29f4de62211262092967617b |
|
MD5 | b42528d4c6f4201c785e4f717ee37704 |
|
BLAKE2b-256 | e87331da9df4e56d3894d0edf229aca8a716c90c2e901d2f9bda45336d63c956 |
File details
Details for the file l5x-1.6-py2.py3-none-any.whl
.
File metadata
- Download URL: l5x-1.6-py2.py3-none-any.whl
- Upload date:
- Size: 52.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7d2441399eec2ab56bbe300a70fd8c221c3b38be2508c5525c9e65932d6c89c |
|
MD5 | 715ee583f76d56037e3a4c0455658f21 |
|
BLAKE2b-256 | af30942be06f4a4e685e9f8f1a7e200e5460c7aa76be4a148cd5d7d1a9805f67 |