SemaPLC: A Project-Grounded, Verification-Gated Agent Harness for PLC Code Generation

Yanlun Tu, Huacan Wang, Ziyue Zhou, Jie Zhou, Ningyan Zhu, Ge Chen, Wangyi Chen, Tengfei Zhou, Yifan Zhou, Dasheng Yang, Xiaofeng Mou, Hui Zhang, Yi Xu

arXiv:2608.18565 · 2026-08-20 공개 · arXiv · PDF

agent-harness industrial-automation control-logic plc-code-generation verification-gated project-grounded runtime-execution static-compilation

Abstract

Programmable logic controllers (PLCs) run industrial plants, and large language models can already generate independent program organization units (POUs) for them. Whether such logic integrates into an existing PLC project and then runs correctly has been checked only in limited tests. We present SemaPLC, a project-grounded and verification-gated agent harness assembled from conventional tools but governed by a strict completion rule. Rather than stopping when the model judges its own output adequate, SemaPLC declares a task complete only when logged external checks confirm it. Those checks cover the specification, the compilation, and the behavior on a live runtime. On 117 independent-POU tasks matching existing benchmarks, it attains the highest strict verified pass rate on all seven models (72.6\% mean). On a project-context track of 65 tasks whose generated logic must compile and run inside a real project, it attains the highest mean on integrated compilation, static behavior, and dynamic behavior. Of the three layers, dynamic behavior is the most revealing. We measure it by deploying the generated and the reference logic to a live PLC runtime and comparing their executed traces. All methods fall within 10 static points of one another, whereas dynamic scores separate them sharply, from 22.4 to 31.4 for the baselines against 52.2 for SemaPLC. Overall, our verification-gated harness raises the mean at every layer and most sharply at runtime. Execution, not static scoring, is the faithful test of whether generated control logic actually works. SemaPLC is open-sourced at https://github.com/midea-ai/SemaPLC.

한국어 요약

한 줄 요약

SemaPLC는 PLC 코드 생성 시 프로젝트 기반 및 검증 기반의 에이전트 허네스를 제시하여 실행 시 정확도를 52.2% 달성한다.

핵심 기여도

핵심 아이디어

SemaPLC는 PLC 코드 생성 시 모델이 자체적으로 판단하는 것이 아닌, 외부 검증(스펙, 컴파일, 런타임 실행)을 기반으로 작업 완료를 결정한다. 이는 기존 연구에서 주로 고려되지 않았던 프로젝트 내 통합 및 런타임 동작 검증을 강조한다. 특히, 생성된 코드가 실제 PLC 런타임 환경에서 실행되며 추적(traces)을 비교함으로써 동적 행동을 평가하는 점이 핵심이다. 이는 정적 점수보다 실행 결과가 더 믿을 수 있음을 입증한다.

기술적 접근법

주요 결과

의의 및 한계

SemaPLC는 PLC 코드 생성 시 정적 점수보다 실행 결과를 기반으로 검증함으로써 실제 작동 여부를 정확히 평가할 수 있는 새로운 접근법을 제시한다. 특히, 프로젝트 내 통합 및 런타임 동작 검증을 강조하여 산업 현장에서의 신뢰성을 높일 수 있다. 그러나 한계로는 동적 점수는 제한된 시나리오만 평가하며, 미见过 조건에서는 정확도가 보장되지 않으며, 가장 강력한 모델에서는 성능 차이가 줄어드는 점이 있다.

실용적 활용

SemaPLC는 제조, 전력, 물 처리 시설 등 PLC가 사용되는 산업 현장에서 신뢰성 있는 코드 생성을 지원할 수 있다. 또한, PLC 개발 환경에서 편집, 생성, 배포 과정을 동일한 검증 게이트로 통합하는 데 활용 가능하다.