Ladder Logic Translation using Large Language Models in Industrial Automation

Oluwatosin Ogundare, Promise Ekpo, Nathanial Wiggins · 2026

Read Ladder Logic Translation using Large Language Models in Industrial Automation by Oluwatosin Ogundare, Promise Ekpo, Nathanial Wiggins (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-31458.txt.

Introduction

Ogundare, Ekpo and Wiggins tackle translating ladder logic for factory automation, where changing PLC vendors is hard. Vendor tools differ in setup, ladder parts and meaning, and black-box tools block the move. The team sets out the maths and a well-built pipeline. It pulls XML, tidies structure, uses a guarded LLM step, and links into Siemens tools through the TIA Portal Openness API. It turns Rockwell ladder code into Siemens S7 code. Tests show the new code keeps its meaning across instruction types.

Catalog record

CREATOROluwatosin Ogundare, Promise Ekpo, Nathanial Wiggins
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE9686
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2605.31458

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Ladder Logic Translation using Large Language Models in Industrial Automation Oluwatosin Ogundare, Promise Ekpo, Nathanial Wiggins Abstract Ladder logic translation is an important problem in industrial automation because without it, it is difficult to switch Programmable Logic Controller (PLC) vendors. The prevailing translation problem highlights mismatched programming environments, incompatible ladder logic constructs, limitations in terms of differences in the semantic expressiveness of the vendor formalisms and integrated black-box proprietary engineering tools which are exemplified in our example case; Rockwell to Siemens PLC code translation. This work presents a mathematical formulation of the problem, the detailed architecture of a solution which supports XML extraction, structural normalization, constrained generative function (LLM), and system integration via the TIA Portal Openness API as rigorously engineered pipeline for automated translation of Rockwell Ladder Programs to Siemens S7 ladder programs. Finally, we present results that show that the translations retain high semantic consistency across instruction categories. Introduction Code translation with Large Language Models (LLMs) is an important problem in enterprise software [ 13 ] , but industrial automation remains difficult because PLC ecosystems are highly vendor-specific. For example, Rockwell Automation employs the XML-based L5X format, whereas Siemens TIA Portal exposes S7 program blocks through the TIA Openness API [ 12 ] [ 6 ] . Although both platforms nominally adhere to IEC 61131-3, substantial differences remain in execution semantics, branch representations, and general instruction formalisms which limits practical interoperability despite XML standardization [ 11 ] [ 2 ] . Although, migration tools exist, they often rely on static instruction mappings that require extensive manual correction for nested branch logic and other vendor-specific constructs [ 1 ] . Recent advances in LLM reasoning capabilities, together with growing adoption in industrial engineering [ 9 ] [ 8 ] , create opportunities for translating structured industrial logic through symbolic representations [ 4 ] [ 3 ] . Platform-agnostic intermediate representations have previously been explored for automation and verification tasks [ 10 ] [ 5 ] ; however, our approach performs an object-oriented reduction of serialized XML to support constrained LLM-guided translation and deterministic post-processing. Figure 1 describes the overall architecture of the translator. The remainder of this paper is organized as follows: Section 1 formalizes the translation problem as a sequence transduction over an intermediate representation. Section 2 describes the staged pipeline, LLM translation engine, and presents quantitative evaluation results on a shift-register program. Section 3 concludes with future directions. 1 Formalism of sequence transduction over IR In our example case, <Task> elements define execution behavior and scheduling constraints, <Program> elements determine scan order through <ScheduledPrograms> , and <Routine> elements encode executable logic units. Therefore, we define the intermediate representation (IR) as the n -tuple, such that IR=(T,P(\cdot),R(\cdot),L(\cdot)) , where each component captures a distinct layer of the PLC execution hierarchy. Let T=\{t_{i}\}_{i=1}^{n} denote the finite set of execution tasks, with associated program mappings P(t_{i})=\{p_{i1},p_{i2},\dots,p_{ik}\} and routine mappings R(p_{ij})=\{r_{ij1},r_{ij2},\dots,r_{ijm}\} . Each routine containing ladder logic is then expressed as an ordered rung sequence L(r_{ijm})=(u_{1},u_{2},\dots,u_{k}) . Sequence transduction formulation We define the semantic function associated with a routine r as the composition of its constituent rung-level transformations: \delta_{r}=u_{k}\circ u_{k-1}\circ\cdots\circ u_{1} (1) Given that function composition is non-commutative in general, i.e., the ordering of transformations is essential, we know that u_{i}\circ u_{j}\neq u_{j}\circ u_{i} (2) It therefore follows that the mapping from an ordered sequence of instructions to its induced transformation, (u_{1},\dots,u_{k})\mapsto\delta_{r} (3) is inherently order-sensitive. This implies that the intermediate representation (IR) induces a sequence-dependent transformation over instruction space, i.e., a sequence transduction problem for which an LLM can be applied. Hierarchical Compositional Structure Additionally, the mapping shown in (3) implies that the IR induces a structure through its hierarchy from derived higher-order compositions. Let \bigcirc be a composition operator over transformation mappings. The IR induces higher-order compositions like so: \delta_{r}=\bigcirc_{u\in L(r)}u,\quad\delta_{p}=\bigcirc_{r\in R(p)}\delta_{r},\quad\delta_{t}=\bigcirc_{p\in P(t)}\delta_{p} (4) Therefore, the full execution semantics of a PLC may be expressed as the nested composition: \delta=\bigcirc_{t\in T}\delta_{t} (5) This is crucial because it formalizes how complex PLC execution semantics emerge from the composition of simple instructions in a principled, order-sensitive way and fits well with sequence based ML algorithms. All symbols retain their meaning from the IR formalism. 2 Architecture Overview and LLM Translation Engine The architecture in Figure 1 implements a staged pipeline that transforms Rockwell L5X ladder logic into Siemens SimaticXML importable through TIA Portal. The process begins with recovery of the L5X XML using a best-effort parser written in C# , followed by construction of a deterministic object-oriented intermediate representation (IR) capturing task hierarchies, routines, rung structures, and symbolic tag references. This reduces the burden on the generative model while remaining constrained by the SimaticXML schema. Figure 1: L5X-to-SimaticXML translation pipeline The core translation stage employs an LLM fine-tuned on aligned pairs of L5X-derived representations and SimaticXML blocks. The model is conditioned on Siemens-specific schema fragments and block patterns, enabling structural validity [ 12 ] . Deterministic post-processing then applies rule-based structural corrections for common translation failures, including ladder network reconstruction and reference normalization, before assembling a fully importable Siemens engineering project. The translation engine shown in Figure 2 constitutes the semantic core of the pipeline. Figure 2: LLM-guided rung-level translation architecture Schema-constrained Prompting & Consistency Check Translation prompts embed explicit structural context, including SimaticXML schema fragments, Siemens block templates (OB, FB, FC), and permissible instruction enumerations, thereby constraining generation toward structurally valid outputs. For each rung-level IR instance, the model additionally generates a natural-language behavioral explanation and derives a SimaticXML representation. A cosine similarity metric [ 7 ] is then computed between SimaticXMLs derived from Rockwell L5X and from natural-language descriptions; outputs below a predefined threshold are rejected. Evaluation of LLM translation of Shift Registers ladder logic in an L5X project Figure 3 illustrates the shift-register control program used for evaluation. The original Allen-Bradley L5X project was translated into Siemens SimaticXML, with routines mapped into Siemens Function Blocks (FCs) and ladder rungs mapped into CompileUnit networks. Quantitative evaluation results are summarized in Table 1 and Figure 4 . Figure 3: Shift-register ladder logic in an L5X project Translation Category Total Elements Correctly Translated Partially Correct / Failed Untranslated / Failed Task / Program / Routine Hierarchy 11 11 (100.0%) 0 (0.0%) 0 (0.0%) RLL Rungs \rightarrow CompileUnit Networks 64 58 (90.6%) 4 (6.3%) 2 (3.1%) Bracketed Branch Logic 41 35 (85.4%) 5 (12.2%) 1 (2.4%) Arithmetic and Comparison Operations (EQU, GEQ, LEQ) 96 89 (92.7%) 6 (6.3%) 1 (1.0%) Data Movement & State Coils (MOV, OTL/OTU, SCoil) 78 69 (88.5%) 6 (7.7%) 3 (3.8%) Controller / Program Scope Tags and Global Variables 147 134 (91.2%) 10 (6.8%) 3 (2.0%) Overall Translation 437 396 (90.6%) 31 (7.1%) 10 (2.3%) Table 1: Quantitative Evaluation of L5X to SimaticXML Translation for Shift Register Logic Figure 4: Evaluation results over the categories 3 Conclusion Our evaluation focuses on a shift register control program and is intended to validate the proposed translation architecture rather than provide comprehensive coverage of all PLC constructs. Results in Table 1 and Figure 4 show that explicitly modeled hierarchical structures are preserved deterministically, achieving 100% accuracy in Task / Program / Routine mappings. High accuracy in arithmetic operations (92.7%) and tag handling (91.2%) further suggests that constrained intermediate representations(IR) improve symbol-level

Read the complete text