arXiv:2610.28160cs.SEOct 2026

Manuscript Offprint

arXiv:2610.28160

From Code Generator to Engineering Companion: A Plant-aware Agent for PLC Programming

Joschka Kersting, Gesa Benndorf

Joschka Kersting, Gesa Benndorf

Fraunhofer IOSB-INA

Lemgo, Germany

{joschka.kersting, gesa.benndorf}@iosb-ina.fraunhofer.de

Abstract—Programmable Logic Controller (PLC) coding remains a manual, IDE-centric task that demands constant context switching between documentation, project files, and code editors. Recent work has demonstrated that retrieval-augmented large language models can generate vendor-compliant Structured Text at high compilation rates [1], yet these systems treat code generation as a one-shot pipeline: the engineer submits a query and receives code, with no persistent knowledge of the specific plant. We present a plant-aware conversational copilot that extends this paradigm in three directions: plant-specific context ingestion, a chat-first interaction model for explanation and debugging, and a graduated tool-access ladder from chat to deployment. The system is designed for real plant infrastructure and keeps the engineer in control of each step that produces real-world effects.

Index Terms—LLM, PLC, Structured Text, IEC 61131-3, Engineering Copilot, Plant Context, Human-in-the-Loop

1

I. INTRODUCTION

Every production facility runs on control logic authored by automation engineers who navigate a demanding workflow: read the I/O specification, open the vendor IDE, locate the relevant function-block documentation, write Structured Text (ST) code, compile, fix errors, and repeat. Large language models have begun to reduce this friction. Prior work [1] demonstrated that a retrieval-augmented coding assistant for Mitsubishi Electric's GX Works3 environment can generate vendor-compliant ST code at high compilation rates using only a structured knowledge base of function-block definitions and documentation excerpts, without exposing proprietary code to cloud providers.

Yet that earlier system operates as a pipeline. The engineer submits a natural-language task, the model generates code, and the compilation server validates it. There is no persistent knowledge of the specific plant, let alone an iterative dialogue, and no path from chat to deployment.

The gap we address is not code generation per se, but the engineering interaction model. A copilot that knows the plant-specific I/O list, labels, and existing program fragments can generate code that is immediately appropriate for the target namespace. Moreover, in our setting we find that agents often only write correct code when they know the real-world setup of the plant. Together, these aspects form the difference between a generic coding tool and an engineering companion. Unlike generic copilots (e.g., GitHub Copilot on a CODESYS MCP server), our contribution is not the chat mechanism itself but its coupling with plant-specific context retrieval and a domain-tailored, safety-graduated tool ladder.