ChatPaper.aiChatPaper

SemaPLC:一种项目驱动的、验证门控的PLC代码生成智能体框架

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

August 19, 2026
作者: 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
cs.AI

摘要

可编程逻辑控制器(PLC)运行着工业设备,而大语言模型已经能够为其生成独立的程序组织单元(POU)。然而,此类逻辑能否集成到现有PLC项目中并正确运行,此前仅在有限的测试中得到验证。我们提出了SemaPLC,一个基于项目上下文且以验证为门控的智能体框架,它由常规工具组装而成,但受严格的完成规则约束。SemaPLC并非在模型判断自身输出足够时停止,而是仅在记录在案的外部检查确认通过后才宣布任务完成。这些检查覆盖规范、编译以及在实际运行时上的行为。在与现有基准匹配的117个独立POU任务上,SemaPLC在全部七个模型上取得了最高的严格验证通过率(平均72.6%)。在包含65个任务的项目上下文赛道中,生成逻辑必须在真实项目内编译并运行,SemaPLC在集成编译、静态行为和动态行为方面均取得了最高平均值。在这三个层面中,动态行为最具揭示性。我们通过将生成逻辑和参考逻辑部署到实际PLC运行时,并比较其执行轨迹来对其进行测量。所有方法的静态得分彼此相差均在10分以内,而动态得分则将它们明显区分开来:基线方法为22.4至31.4,SemaPLC则为52.2。总体而言,我们的验证门控框架在每个层面都提升了平均值,且在运行时层面提升最为显著。执行而非静态评分,才是检验生成的控制逻辑是否真正有效的可靠标准。SemaPLC已在 https://github.com/midea-ai/SemaPLC 开源。
English
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.