l5x-0.3.0 has been yanked.
l5x
A Rust library for parsing Rockwell Automation L5X files exported from Studio 5000 Logix Designer.
Features
- Fast, type-safe parsing using quick-xml and serde
- Complete L5X schema support - 247 types generated from the official XSD
- RLL (Relay Ladder Logic) parsing - parse ladder logic instructions into AST
- Tag reference extraction - find all tag references in rungs
Installation
Add to your Cargo.toml:
[]
= "0.3"
Usage
Parse an L5X file
use Project;
let xml = read_to_string?;
let project: Project = from_str?;
// Access controller information
println!;
// Iterate over programs
for program in &project.controller.programs.program
Parse ladder logic rungs
use parse_rung;
let rung = parse_rung;
// Extract tag references
for tag in rung.tag_references
Access tags and data types
use Project;
let project: Project = from_str?;
// Controller-scoped tags
if let Some = &project.controller.tags
// User-defined types
if let Some = &project.controller.data_types
L5X File Format
L5X is an XML-based export format for Rockwell Automation PLCs. This crate supports:
- Controllers: ControlLogix, CompactLogix
- Programs: with routines in RLL, ST, FBD, SFC
- Tags: Controller and program-scoped
- Data Types: Built-in and user-defined (UDTs)
- Add-On Instructions (AOIs)
- Modules: I/O configuration
- Tasks: Continuous, periodic, event
RLL Instruction Support
The RLL parser handles standard ladder logic syntax:
- Instructions: XIC, XIO, OTE, OTL, OTU, TON, TOF, CTU, CTD, MOV, ADD, etc.
- Branches: Parallel and series connections
- Expressions: Arithmetic and comparison in CMP, CPT, etc.
- Arrays: Multi-dimensional with literal or tag indices
- Structured tags: Member access (e.g.,
Timer.DN)
Disclaimer
This is an independent open-source project and is not affiliated with, endorsed by, sponsored by, or associated with Rockwell Automation, Inc. or any of its subsidiaries or affiliates.
"Rockwell Automation", "Allen-Bradley", "Studio 5000", "Logix Designer", "ControlLogix", and "CompactLogix" are trademarks of Rockwell Automation, Inc.