Automatic Generation of PLC Code Based on Finetuned Large Language Models
Programmable Logic Controllers (PLCs) are fundamental components of modern industrial automation, enabling precise control, monitoring, and data processing of complex production systems. Structured Text (ST), defined by the IEC 61131–3 standard, is a high-level language widely used for developing sophisticated PLC software. This study proposes an automated ST code generation workflow based on large language models (LLMs) to improve the efficiency of PLC programming. We first construct a domain-specific dataset that aligns ST code with corresponding natural language descriptions and fine-tune pretrained LLMs to adapt them to the industrial control domain. Next, we employ prompt engineering techniques to enhance both the functional correctness and domain relevance of the generated code. Finally, we integrate a verification mechanism that utilizes compiler-based syntax checking to detect errors and iteratively refine model outputs through feedback. Experimental results demonstrate that our platform significantly improves the quality of generated ST code while reducing overall development time.
Authors
- Xiaojun Liang (ORCID: https://orcid.org/0000-0003-1712-7983)
- Wenfeng Deng (ORCID: https://orcid.org/0000-0001-8725-860X)
- Linghao Ren (ORCID: https://orcid.org/0000-0002-4574-2329)
- Shuai Liu (ORCID: https://orcid.org/0000-0002-0699-2296)
- Nan Zhou (ORCID: https://orcid.org/0009-0008-8429-550X)
- Chunhua Yang (ORCID: https://orcid.org/0000-0002-3770-9887)
Institutions
- Central South University (CN)
- Southern University of Science and Technology (CN)
- Peng Cheng Laboratory (CN)
Publication Details
- Published
- 2025-07-11
- DOI
- https://doi.org/10.1109/ieeeconf65522.2025.11136984
- Citations
- 1
- Primary Topic
- Advanced Computational Techniques and Applications
- Type
- article
- Field-Weighted Citation Impact
- 2.48
Funders
- National Natural Science Foundation of China