Work

Beyond Compilation with Runtime Diagnosis and Repair of Function Block Diagrams Generated by LLMs

Year: 2026
Type: article
Abstract: Function Block Diagrams (FBDs) generated by large language models (LLMs) can compile in an industrial integrated development environment (IDE) while still violating the intended control behavior. We present a runtime diagnosis and repair pipeline that connects a topology with typed pins, PLCopen XML import, CODESYS compilation, and SoftPLC execution. The pipeline returns structured compilation diagnostics and runtime state observations that guide localized repair. Across a benchmark of 20 cases, the full configuration achieves 20/20 compilations on the first pass, compared with 8/20 without retrieval and 5/20 for a naive baseline. Repair raises the setting without retrieval to 13/20 within five attempts. The ablation shows that retrieved function block interfaces are the main driver of first pass compilation, while repair provides complementary recovery. For runtime evidence, a compiled pump cascade program initially passed 2 of 6 diagnostic assertions. After two cycles of diagnosis and repair, it passed all 18 assertions in an expanded final verification suite. Across the benchmark suite, 118/118 executed assertions derived from requirements were satisfied after repair. A targeted defect injection study detected 7/8 defects not visible at compilation across four mechanisms. These results demonstrate a practical path for compiling, testing, and repairing control logic generated through FBD workflows.
Source: Electronics
Language: English
Subfield: Software
Open Access status: gold
Estimated APC paid: $2,896
OpenAlex ID: W7225199751
FWCI:
Cites: 15
Cited by:
Related to: 10