MBSE-Driven PLC Code Generation and AI-Augmented Test Scenario Validation
Abstract
This paper presents a framework for automatically generating and validating scenario-based test suites for PLC programs using large language models (LLMs) in a virtual commissioning approach, Software in the Loop (SIL). An initial approach and expanded version that integrates Model-Based System Engineering (MBSE) are introduced. In the initial approach, LLMs are used to generate scenario-based test suites based on PLC programs in Structured Text (ST), and scenarios are executed automatically using Python as a supervisor, CODESYS virtual PLC, and Factory IO simulation. The approach was tested using a simple conveyor system, and the results showed that LLMs can understand the ST code and generate relevant scenarios and test cases. But manual checking is required because generated scenarios suffer from incorrect inference, and preconditions are not clearly defined. The expanded version incorporates MBSE, using Capella and automatic ST code and functional requirement generation from the Capella model. The scenario-based test suites were generated in a single prompt because the LLMs have more data about the system, as well as example files from the previous work. The ST code generated by the LLMs was compared to the ST code written manually, and besides saving time, the quality of the code was found to be significantly better and more professional.
Fields of Study & Subjects
Software Testing and Debugging Techniques
Real-time simulation and control systems
VLSI and Analog Circuit Testing
Publication details
- Journal / source
- 2026 12th International Conference on Automation, Robotics and Applications (ICARA)
- Publisher
- IEEE
- Pages
- 575–580
- Publication date
- 5 February 2026