feat: Add centralized IEC 61131-3 type conversion layer#96
Closed
marconetsf wants to merge 1 commit into
Closed
Conversation
This commit introduces a common type conversion infrastructure for all plugins: - iec_type_registry.py: Centralized registry of all 22 IEC 61131-3 types with metadata (bounds, size, ctypes class, register count, etc.) - iec_type_converter.py: Unified conversion utilities including: - Value clamping with signed/unsigned handling - Float <-> integer bit representation conversion - Modbus register combination/splitting with endianness support - IEC_TIMESPEC time type conversions - Default value generation per protocol This eliminates type conversion duplication across plugins (OPC-UA, Modbus, S7Comm, etc.) and ensures consistent type handling throughout the system. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a centralized type conversion infrastructure for all plugins, addressing the issue of duplicated type conversion code across OPC-UA, Modbus, S7Comm, and future plugins (EtherCAT, etc.).
New modules added to
core/src/drivers/plugins/python/shared/:iec_type_registry.py- Centralized registry of all 22 IEC 61131-3 types:iec_type_converter.py- Unified conversion utilities:Benefits
Usage example
Test plan
This is the foundation layer. A follow-up PR will refactor existing plugins (OPC-UA, Modbus) to use these shared utilities.
Generated with Claude Code