A previous release had provenance metadata, but this release does not. View details.
PLC Format Converter - a python library
🚀 Phase 3.9 Enhanced Capabilities
Industry-Leading Data Preservation: 99%+ data preservation (730x improvement over baseline)
Key Features
- Enhanced ACD Binary Parsing: Complete component extraction with binary format analysis
- Comprehensive L5X Generation: Full PLC logic preservation with Studio 5000 compatibility
- Data Integrity Validation: Weighted scoring system for conversion quality assessment
- Git-Optimized Output: Version control friendly formatting for meaningful diffs and merges
- Round-Trip Validation: Automated ACD↔L5X conversion integrity verification
Supported Components
- ✅ Ladder Logic (RLL) with complete instruction preservation
- ✅ Tag Database with complex UDT support
- ✅ I/O Configuration with module-level detail
- ✅ Motion Control with axis and group parameters
- ✅ Safety Systems (GuardLogix) with signature validation
- ✅ Program Organization with task assignments
Modern ACD ↔ L5X conversion library with industrial-grade validation and motion control support
Convert between Rockwell Automation's PLC file formats with comprehensive validation, motion control detection, and safety system support.
✨ Key Features
- 🔄 Bidirectional Conversion - ACD ↔ L5X with data integrity
- 🏭 Industrial-Grade Validation - Multi-tier validation framework
- ⚡ Motion Control Support - MAOC, MAPC, MAAT instruction detection
- 🛡️ Safety System Support - GuardLogix safety instruction validation
- 🎯 Type-Safe - Built with Pydantic for robust data models
- 📊 Comprehensive Reporting - Detailed validation reports
- 🌐 Cross-Platform - Works on Windows, Linux, macOS
- 📦 Easy Installation - Available via pip
🚀 Quick Start
Installation
# Install the library
pip install plc-format-converter
# Install with optional dependencies
pip install plc-format-converter[all] # All features
pip install plc-format-converter[acd-tools] # ACD support only
pip install plc-format-converter[l5x] # Enhanced L5X support
Basic Usage
from plc_format_converter import ACDHandler, L5XHandler, PLCValidator
# Convert ACD to L5X
acd_handler = ACDHandler()
l5x_handler = L5XHandler()
# Load ACD project
project = acd_handler.load("MyProject.ACD")
print(f"Loaded: {project.name} ({project.controller.processor_type})")
# Validate before conversion
validator = PLCValidator()
result = validator.validate_project(project)
print(f"Validation: {'✅ PASS' if result.is_valid else '❌ FAIL'}")
# Save as L5X
l5x_handler.save(project, "MyProject.L5X")
print("✅ Conversion completed!")
📚 Documentation
Format Handlers
ACD Handler - Automation Control Database
from plc_format_converter.formats import ACDHandler
handler = ACDHandler()
# Check capabilities
caps = handler.get_capabilities()
print(f"Motion Control: {caps['features']['motion_control']}")
print(f"Safety Systems: {caps['features']['safety_systems']}")
# Load ACD file
project = handler.load("Industrial_System.ACD")
# Access project components
for program in project.programs:
print(f"Program: {program.name}")
for routine in program.routines:
print(f" Routine: {routine.name} ({routine.type.value})")
L5X Handler - Logix Designer Export Format
from plc_format_converter.formats import L5XHandler
handler = L5XHandler()
# Load L5X file
project = handler.load("Production_Line.L5X")
# Analyze structured text for motion instructions
for program in project.programs:
for routine in program.routines:
if routine.type.value == "ST" and routine.structured_text:
if "MAOC" in routine.structured_text:
print(f"🎯 Motion instruction found in {routine.name}")
# Save with modifications (full round-trip support)
handler.save(project, "Modified_Production_Line.L5X")
Validation Framework
from plc_format_converter.utils import PLCValidator
validator = PLCValidator()
# Configure validation options
validation_options = {
'capabilities': True, # Controller capability validation
'data_integrity': True, # Data consistency checks
'instructions': True # Motion/safety instruction validation
}
# Run comprehensive validation
result = validator.validate_project(project, validation_options)
# Analyze results
print(f"Status: {'✅ PASS' if result.is_valid else '❌ FAIL'}")
print(f"Issues: {len(result.issues)}")
# Show detailed issues
for error in result.get_errors():
print(f"❌ {error.category}: {error.message}")
if error.recommendation:
print(f" 💡 {error.recommendation}")
# Generate detailed report
report = validator.generate_validation_report(result)
with open("validation_report.txt", "w") as f:
f.write(report)
Supported Controllers
| Controller | Programs | Tags | Motion | Safety | I/O Modules |
|---|---|---|---|---|---|
| ControlLogix | 1,000 | 250,000 | ✅ | ❌ | 128 |
| CompactLogix | 100 | 32,000 | ✅ | ❌ | 30 |
| GuardLogix | 1,000 | 250,000 | ✅ | ✅ | 128 |
🔧 Advanced Usage
Custom Validation Rules
from plc_format_converter.utils import PLCValidator, ValidationIssue, ValidationSeverity
class CustomValidator(PLCValidator):
def validate_naming_conventions(self, project, result):
"""Custom naming convention validation"""
for program in project.programs:
if not program.name.startswith("PGM_"):
result.add_issue(ValidationIssue(
severity=ValidationSeverity.WARNING,
category="naming_convention",
message=f"Program {program.name} doesn't follow PGM_ convention",
component=f"Program.{program.name}",
recommendation="Use PGM_ prefix for all programs"
))
validator = CustomValidator()
result = validator.validate_project(project)
Batch Processing
from pathlib import Path
def batch_convert_l5x_files(input_dir: str, output_dir: str):
"""Convert multiple L5X files with validation"""
handler = L5XHandler()
validator = PLCValidator()
for l5x_file in Path(input_dir).glob("*.L5X"):
try:
# Load and validate
project = handler.load(l5x_file)
result = validator.validate_project(project)
# Save processed file
output_file = Path(output_dir) / f"validated_{l5x_file.name}"
handler.save(project, output_file)
print(f"✅ {l5x_file.name}: {len(result.issues)} issues")
except Exception as e:
print(f"❌ {l5x_file.name}: {e}")
# Process all files in directory
batch_convert_l5x_files("input_projects/", "validated_projects/")
🛠️ Development
Setting Up Development Environment
# Clone repository
git clone https://github.com/plc-gpt/plc-format-converter.git
cd plc-format-converter
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Run linting and formatting
ruff check src/
ruff format src/
black src/
Project Structure
plc-format-converter/
├── src/plc_format_converter/
│ ├── __init__.py # Package initialization
│ ├── core/
│ │ ├── models.py # Core data models (Pydantic)
│ │ └── converter.py # Main converter logic
│ ├── formats/
│ │ ├── __init__.py
│ │ ├── acd_handler.py # ACD format handler
│ │ └── l5x_handler.py # L5X format handler
│ └── utils/
│ ├── __init__.py
│ └── validation.py # Validation framework
├── tests/ # Comprehensive test suite
├── docs/ # Documentation
├── pyproject.toml # Package configuration
└── README.md # This file
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=plc_format_converter
# Run specific test categories
pytest -m unit # Unit tests only
pytest -m integration # Integration tests only
pytest -m "not slow" # Skip slow tests
📖 API Reference
Core Models
All data models are built with Pydantic for type safety:
from plc_format_converter.core.models import (
PLCProject, # Root project container
PLCController, # Controller configuration
PLCProgram, # Program container
PLCRoutine, # Individual routines
PLCTag, # Tag definitions
PLCDevice, # I/O devices
DataType, # PLC data types enum
RoutineType, # Routine types enum
)
# Create a new project
project = PLCProject(
name="MyProject",
controller=PLCController(
name="MainController",
processor_type="ControlLogix"
)
)
Error Handling
from plc_format_converter.core.models import (
ConversionError, # General conversion errors
FormatError, # Format-specific errors
ValidationError # Validation errors
)
try:
project = handler.load("corrupted_file.L5X")
except FormatError as e:
print(f"Format error: {e}")
except ConversionError as e:
print(f"Conversion error: {e}")
🤝 Contributing
Contributions are welcome! Please see our Contributing Guide for details.
Development Workflow
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run the test suite:
pytest - Submit a pull request
Code Quality
This project uses:
- Ruff for linting and formatting
- Black for code formatting
- MyPy for static type checking
- Pytest for testing
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Rockwell Automation for PLC file format specifications
- acd-tools library for ACD parsing capabilities
- l5x library for L5X processing
- The industrial automation community for feedback and contributions
📊 Project Status
- ✅ Stable: Core format conversion functionality
- ✅ Stable: Validation framework
- ✅ Stable: Motion control instruction detection
- ✅ Beta: Safety system validation
- 🚧 Development: Advanced analytics and reporting
- 📋 Planned: Real-time monitoring capabilities
🔗 Related Projects
- PLC-GPT - AI-powered PLC programming assistant
- Studio 5000 Integration - Windows COM automation
- Format Compatibility Checker - Legacy validation tools
For the latest updates and detailed documentation, visit our documentation site.
Metadata
Release files for plc-format-converter 2.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Loss of provenance
These files do not have provenance metadata, despite files in a prior release including this data.
We recommend further investigation before installing these files. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plc_format_converter-2.1.2.tar.gz | 69.8 kB | Without provenance | Details for plc_format_converter-2.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plc_format_converter-2.1.2-py3-none-any.whl | Python 3 | none | any | Details for plc_format_converter-2.1.2-py3-none-any.whl |
Total release size: 127.2 kB
Release files / plc_format_converter-2.1.2.tar.gz
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | plc_format_converter-2.1.2.tar.gz |
|---|---|
| Size | 69.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc65fa15abad1434493ad998710e75d663dba45072bb8ba4f491a70c3f7d532b
|
|
BLAKE2b-256 checksum How to use checksums |
9c3c498f62917a3e153db4ce7a4c6762b63db61ae2f51098ff032099ba4b877b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Release files / plc_format_converter-2.1.2-py3-none-any.whl
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | plc_format_converter-2.1.2-py3-none-any.whl |
|---|---|
| Size | 57.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18c5397ba8d0d8fdb72044e9e29170c97b4ed2501d5d90cf8d00e12f4671d92c
|
|
BLAKE2b-256 checksum How to use checksums |
2728490072f701341eeec9bf54ede4b1edea4dd82cfdbff9b7b3b5f5b28203b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.6
|
Security for plc-format-converter 2.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Loss of provenance
A previous release of these files had provenance metadata, but this release does not.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Release comparison
- Removed 2.1.0 2 files With provenance
- Added 2.1.2 2 files Without provenance
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.