Multi-Agent System for Cross-Platform PLC Code Generation with Domain Adaptation

Authors

  • Pengcheng Pei Liaoning Institute of Science and Technology, China Author

DOI:

https://doi.org/10.62677/IJETAA.2510141

Keywords:

PLC code generation, Multi-agent systems, Large language models, Retrieval-augmented generation, Industrial automation

Abstract

Programmable Logic Controllers (PLCs) are fundamental to industrial automation systems. However, traditional PLC programming requires extensive domain expertise and significant time investment, while code reusability remains limited and cross-platform adaptation poses substantial challenges. With the rapid advancement of Large Language Models (LLMs), LLM-based code generation offers a promising approach to address these issues. Nevertheless, existing methods still face challenges when handling complex industrial scenarios, including insufficient domain knowledge, unstable code quality, and weak cross-platform adaptation capabilities. This paper presents a multi-agent system for intelligent cross-platform PLC code generation, featuring a collaborative framework consisting of four specialized agents: requirement analysis, architecture design, code generation, and verification-optimization. The method injects domain knowledge through a Retrieval-Augmented Generation (RAG) mechanism, employs multi-stage prompt engineering strategies to guide code generation, and integrates a three-layer verification mechanism comprising static analysis, dynamic simulation, and expert review to ensure code quality. Experiments on the constructed PLC-MultiTask dataset demonstrate that our method significantly outperforms existing approaches across multiple metrics, achieving 90.3% compilation success rate, 87.6% test pass rate, and 75.4 CodeBLEU score. In an industrial case study involving robotic arm handling of refractory bricks, the system successfully generated approximately 800 lines of structured text code. Field testing over 720 hours demonstrated stable operation with 99.2% handling success rate, reducing development time by 73.3% compared to traditional methods. These results indicate that multi-agent-based PLC code generation significantly enhances development efficiency, ensures code quality, and strengthens cross-platform adaptation capabilities, offering a novel paradigm for industrial automation software development. 

Downloads

Download data is not yet available.

References

M. Seitz, F. Gehlhoff, L. A. Cruz Salazar, A. Fay, and B. Vogel-Heuser, "Automation platform independent multi-agent system for robust networks of production resources in industry 4.0," Journal of Intelligent Manufacturing, vol. 32, no. 7, pp. 2023–2041, Jul. 2021. DOI: 10.1007/s10845-021-01759-2

O. Rashad, O. Attallah, and I. Morsi, "A smart PLC-SCADA framework for monitoring petroleum products terminals in industry 4.0 via machine learning," Measurement and Control, vol. 55, no. 7-8, pp. 830–848, Aug. 2022. DOI: 10.1177/00202940221103305

H. Koziolek, S. Gruener, and V. Ashiwal, "ChatGPT for PLC/DCS control logic generation," in Proc. IEEE 28th Int. Conf. Emerg. Technol. Factory Autom. (ETFA), Sinaia, Romania, Sep. 2023, pp. 1–8. DOI: 10.1109/ETFA54631.2023.10275411

M. Fakih, R. Dharmaji, Y. Moghaddas, G. Q. Araya, O. Ogundare, and M. A. Al Faruque, "LLM4PLC: Harnessing large language models for verifiable programming of PLCs in industrial control systems," in Proc. 46th Int. Conf. Softw. Eng.: Softw. Eng. Pract. (ICSE-SEIP), Lisbon, Portugal, Apr. 2024, pp. 192–203. DOI: 10.1145/3639477.3639743

Z. Liu, R. Zeng, D. Wang, G. Peng, J. Wang, Q. Liu, P. Liu, and W. Wang, "Agents4PLC: Automating closed-loop PLC code generation and verification in industrial control systems using LLM-based agents," arXiv preprint arXiv:2410.14209, Oct. 2024. DOI: 10.48550/arXiv.2410.14209

X. Hou, Y. Zhao, Y. Liu, Z. Yang, K. Wang, L. Li, X. Luo, D. Lo, J. Grundy, and H. Wang, "Large language models for software engineering: A systematic literature review," ACM Trans. Softw. Eng. Methodol., vol. 33, no. 8, pp. 1–79, Nov. 2024. DOI: 10.1145/3695988

S. Joel, J. Wu, and F. Fard, "A survey on LLM-based code generation for low-resource and domain-specific programming languages," ACM Trans. Softw. Eng. Methodol., 2024. DOI: 10.1145/3770084

L. Wang, C. Ma, X. Feng, Z. Zhang, H. Yang, J. Zhang, Z. Chen, J. Tang, X. Chen, Y. Lin, W. X. Zhao, Z. Wei, and J.-R. Wen, "A survey on large language model based autonomous agents," Front. Comput. Sci., vol. 18, no. 6, Article 186345, Mar. 2024. DOI: 10.1007/s11704-024-40231-1

J. Lim, B. Vogel-Heuser, and I. Kovalenko, "Large language model-enabled multi-agent manufacturing systems," in Proc. IEEE 20th Int. Conf. Autom. Sci. Eng. (CASE), Bari, Italy, Aug. 2024, pp. 3940–3946. DOI: 10.1109/CASE59546.2024.10711432

A. Sidorenko, W. Motsch, M. van Bekkum, N. Nikolakis, K. Alexopoulos, and A. Wagner, "The MAS4AI framework for human-centered agile and smart manufacturing," Frontiers in Artificial Intelligence, vol. 6, Article 1241522, Sep. 2023. DOI: 10.3389/frai.2023.1241522

S. Hong, M. Zhuge, J. Chen, X. Zheng, Y. Cheng, C. Zhang, J. Wang, Z. Wang, S. K. S. Yau, Z. Lin, L. Zhou, C. Ran, L. Xiao, C. Wu, and J. Schmidhuber, "MetaGPT: Meta programming for multi-agent collaborative framework," arXiv preprint arXiv:2308.00352, Aug. 2023. DOI: 10.48550/arXiv.2308.00352

Y. Gao, Y. Xiong, X. Gao, K. Jia, J. Pan, Y. Bi, Y. Dai, J. Sun, M. Wang, and H. Wang, "Retrieval-augmented generation for large language models: A survey," arXiv preprint arXiv:2312.10997, Mar. 2024. DOI: 10.48550/arXiv.2312.10997

Y. Wu, Y. Zhao, B. Hu, P. Minervini, P. Stenetorp, and S. Riedel, "An efficient memory-augmented transformer for knowledge-intensive NLP tasks," arXiv preprint arXiv:2210.16773, Oct. 2022. DOI: 10.48550/arXiv.2210.16773

S. Ren, D. Guo, S. Lu, L. Zhou, S. Liu, D. Tang, N. Sundaresan, M. Zhou, A. Blanco, and S. Ma, "CodeBLEU: A method for automatic evaluation of code synthesis," arXiv preprint arXiv:2009.10297, Sep. 2020. DOI: 10.48550/arXiv.2009.10297

M. Evtikhiev, E. Bogomolov, Y. Sokolov, and T. Bryksin, "Out of the BLEU: How should we assess quality of the code generation models?" J. Syst. Softw., vol. 203, Article 111741, Sep. 2023. DOI: 10.1016/j.jss.2023.111741

Downloads

Published

2025-11-28

How to Cite

[1]
P. . Pei, “Multi-Agent System for Cross-Platform PLC Code Generation with Domain Adaptation”, ijetaa, vol. 2, no. 10, pp. 1–8, Nov. 2025, doi: 10.62677/IJETAA.2510141.

Similar Articles

11-20 of 31

You may also start an advanced similarity search for this article.