Skip to content
OT AI HubOT AI Hub

How to verify AI-generated PLC code: compile, unit test, simulate

Verify AI-generated PLC code in a fixed order: compile and static checks, unit tests, simulation or virtual commissioning, a human review of the changeset, then site acceptance. Send each failure back into the next draft. The order follows the three-stage check Fraunhofer IKS describes for MBO-KISS, plus the review and the site gate that check does not replace.

The workflow is vendor-neutral. CODESYS Test Manager and TwinCAT CoAgent appear where a public page describes that step. Where no page states a price, a score, or a safety claim, the cell says Not stated.

Updated 24 November 2026. Fraunhofer, CODESYS, Beckhoff, IEC, CycleBench, and SemaPLC pages opened 23 November 2026.

This is not a site acceptance test. This page did not compile a program, run a unit-test tool, open a changeset, or download to a controller. A vendor sentence is that vendor's claim. A paper figure is that paper's result on the tasks it names. Not stated means the cited page did not say.

Workflow

Six stages. The first three are the Fraunhofer IKS list. The last three are the human review, the site gate, and the feedback loop the same pages describe. A cell is a pointer. The section under it has the sentence.

Opened 23 November 2026. Not stated means the cited page did not say.
StageWhat the cited page saysWhat a pass does not establishSource
1. Compile and static analysisFraunhofer IKS names static analysis of the generated control code as stage one. CODESYS says Static Analysis checks rules in addition to the compiler.CycleBench says execution pass rate trails compilation. A build does not establish scan-by-scan behavior.Fraunhofer IKS project page
2. Unit testsFraunhofer IKS names unit tests as automated code analysis at the functional level. CODESYS Test Manager programs those steps in any IEC 61131-3 language.The CODESYS unit-test help says a unit test cannot be used for system test scenarios. A block pass is not the machine.CODESYS Test Manager
3. Simulation or virtual commissioningFraunhofer IKS names 3D simulation as execution of the code in a machine simulation. CODESYS describes a Simulation Interface to a digital twin.The research comparison records that LADX says simulation is not a safety case. A model pass is not site acceptance.Fraunhofer IKS project page
4. Human review and changesetThe TE1700 manual keeps POU changes in a chat workspace until Accept. Beckhoff says specialists review results before execution.The manual says CoAgent does not generate safety-oriented functions. A reviewed diff is not a functional-safety case.TE1700 manual (PDF)
5. Site acceptance and safetyIEC 62061:2021, on the IEC webstore, covers design, integration, and validation of safety-related control systems for machines.Whether the Fraunhofer workflow meets IEC 61508 or IEC 62061: Not stated. Beckhoff says CoAgent must not be used for functional safety.IEC 62061:2021
6. Feed results backFraunhofer IKS says test results go back into the next generation cycle. The press release calls that an iterative process.The one-tenth error line is Fraunhofer IKS's report on the scenarios it examined. It is not a rate for your plant.Fraunhofer IKS press release

Compile and static analysis

Start with a compiler and a static check, on an offline copy of the project. The MBO-KISS project page, opened 23 November 2026, lists the first stage as code review: static analysis of the generated control code. The 6 November 2026 press release describes the same front of the workflow as code review or static analysis. The project page spells the name MBO-KISS. The press release spells it MBO KISS once and MBO Kiss once.

CODESYS Static Analysis, store version 5.2.0.0, opened 23 November 2026, says the tool checks source code against pre-defined rules and naming conventions in addition to the compiler check, and that more than 100 pre-defined rules are implemented. The Professional Developer Edition page says it finds identical code in multiple places, unreachable branches, unused variables, or output variables written more than once. CODESYS also says that with AI-generated code in everyday workflows, Static Analysis is a quality gate for issues AI-produced code can introduce. That sentence is CODESYS's claim. A measured error rate for that product: Not stated. A separate price for Static Analysis: Not stated. Licensing says see the Professional Developer Edition, and the store page's related-products list shows that edition at €550.00 for 1 user, local license, and from €2,750.00 for 5 users, network license. The Professional Developer Edition page says the bundle is a one-year subscription and that a free demo is in the store. A currency amount on that page: Not stated.

The LLM PLC research comparison, updated 12 November 2026, records the checks already published for the catalogued generators. LLM4PLC uses a grammar checker, a compiler, and the NuXmv model checker. Agents4PLC uses an ST compiler, then nuXmv and PLCverif. AutoPLC compiles through the TIA Portal Openness API and the CODESYS script engine. LADX uses an editor validator, a seal-in check, and the LADV compiler. The same page says a grammar check, a vendor compile, a model-checker result, and a simulator pass answer different questions. The rates stay on that page. This guide does not turn them into one ranking.

Siemens, in the 24 November 2026 milestone release, says Eigen Engineering Agent can verify whether control code behaves as intended, and that this helps engineers identify errors that compilation alone may not detect. The same release says the code verification capability is currently available to Eigen customers at no additional charge during an introductory period, with a paid offering planned in the coming months. A price for that later offering: Not stated. An end date for the introductory period: Not stated. The sentence sits with the further TIA Portal capabilities in that release. Whether the PCS 7 edition includes the same check: Not stated. This page did not run the check. The TIA Portal hub notes the same TIA features.

CycleBench, Chen et al., arXiv:2610.28675, is not a row on that comparison. The abstract introduces 301 Structured Text tasks and says: "Across eight LLMs and baseline generation methods, execution pass rate trails compilation pass rate by 11.92 percentage points; observed failures include output-update, arithmetic, and timing errors." It also says that, on fixed traces of programs directly generated by five LLMs, checking outputs only at every fifth scan misses 21.66% of the 157 failures detected by per-scan comparison, and that the missed-failure rate ranges from 12.10% to 28.03% across sampling phases. Those figures are the paper's. This page did not rerun them.

The comparison names SemaPLC only as related work it does not describe. SemaPLC, Tu et al., arXiv:2608.18565, says: "Compilation alone does not establish runtime behavior, and subsequent edits can invalidate earlier verification results." The abstract says the harness combines project context and reusable PLC skills with specification review, compilation, and live-runtime validation, and that edits invalidate previous verdicts. On 117 independent-POU tasks and 65 project-context tasks across seven language-model backbones, the paper reports a mean verified-pass rate of 72.6% and a mean dynamic score of 52.2, exceeding the strongest baseline means by 8.7% points and 20.8 points. Those means are the paper's. They are not on the comparison page.

Unit tests

The MBO-KISS project page names the second stage as unit tests: automated code analysis at the functional level. It does not name a product, a language dialect, or a pass rate for that stage. A CODESYS or Bosch Rexroth unit-test result inside the project: Not stated on that page. The page does name Codesys Group as an associated partner, which is a different sentence and is quoted below.

CODESYS Test Manager, store version 5.2.0.0, opened 23 November 2026, says it can be used for system-level tests of applications and for unit tests of function blocks. For unit tests, the test steps are programmed in any IEC 61131-3 language and stored in a CODESYS project, which the test driver then includes in the run. The Professional Developer Edition page says tests run on simulated or real target hardware and can sit in a CI/CD pipeline, and that test tables can generate the test code. The unit-test help says the test case is a sandbox for the testee and that the unit test cannot be used for system test scenarios. A measured result on AI-generated code: Not stated. A separate Test Manager price: Not stated. The page says licensing is the Professional Developer Edition subscription, and its related-products list shows that edition from €550.00.

Another IEC 61131-3 unit-test framework, its price, and any claim that it catches AI-generated faults: Not stated. This page sourced the CODESYS Test Manager and did not open a second product manual. The CODESYS Development System MCP Server is a different catalog entry. The Professional Developer Edition page says that MCP server can create and execute tests and can execute the compiler. It does not say the server replaces the Test Manager, and it does not publish a score.

Simulation or virtual commissioning

The project page names the third stage as 3D simulation: execution of the code in a machine simulation. The press release says the generated code is verified with code review or static analysis, unit tests, and 3D simulation, and that the test results are then fed back into the generation process. The project page does not name the simulation tool. A vendor, a model format, and a pass rate for that 3D stage: Not stated.

CODESYS, on the Professional Developer Edition page, describes the Simulation Interface as a connection from a CODESYS runtime to a machine-simulation tool. When the interface is activated, configured I/O is separated from the fieldbus and exchanged with the simulation tool in the PLC cycle, and the runtime application controls the model. CODESYS calls that virtual commissioning on a digital twin before the real machine is available. The page names two connectors as available now, F.EE fe.screen-sim and Cape Sw VPLink, and lists ISG virtuous, Siemens SIMIT, Schneider Machine Expert Twin, digifai twin, dSPACE-SiL VEOS, and Rockwell Emulate3D as upcoming. It says a pre-release has been available since Q2/2025. A result on AI-generated code: Not stated. A price: Not stated. The same page says the interface is part of the Professional Developer Edition bundle.

Closed-loop research grades are a different kind of simulation, and they are already sourced on the research comparison. PLCWorld and AutoFactory-Bench grade Structured Text against a simulated plant. The comparison says those scores are not one ranking, and the benchmark guide explains why the percentages do not share a scale. LADX runs a virtual PLC in the browser. The comparison records that the LADX chat page says a check proves code is well formed, not that it is correct, and that simulation is not a safety case.

CycleBench's evaluator compares a generated program with a reference after every scan, under aligned inputs, initialization, and logical time. The abstract's sampling line is the practical warning: a check that looks only at every fifth scan missed 21.66% of the 157 per-scan failures on fixed traces from five LLMs. A simulation that samples the happy path is a weaker check than the one the paper ran. It is still not a site acceptance test.

Human review and the changeset

A tool can list the failures. A person still accepts the change. The TE1700 manual, version 0.5.2, dated 19 November 2026, says: "Changes to POUs are initially saved temporarily in a chat-specific workspace. They are transferred to the linked PLC project only after you click Accept. Reject rejects the proposal." View Diff opens the Changeset Review. The manual also names a setting, Write PLC changes directly, that writes PLC changes to the project immediately and reviews them afterward. The default is the workspace until Accept.

The same manual says: "TwinCAT CoAgent does not generate safety-oriented functions and must not be used in functional safety applications." It also says TwinCAT CoAgent is a support tool and is not a substitute for inspection by qualified personnel, and that every change must be reviewed and approved by qualified technical staff before it is implemented. The 23 June 2026 press release says engineers remain fully in control, reviewing and approving every AI-generated result before it is applied. The product page, opened 23 November 2026, says the responsible specialists retain full control, reviewing, confirming, and approving all AI-generated results for execution. The product page does not use the word changeset. The changeset steps are in the manual. TwinCAT CoAgent is the catalog row, last verified 4 November 2026. A public price: Not stated on the product page or the press release. The manual's cost overview is an LLM-provider estimate, and Beckhoff says it may not match the provider's invoice.

The research comparison records a smaller version of the same gate. The plant-aware agent paper has the engineer trigger compilation and confirm deployment. LADX checks ladder before it reaches the canvas. Neither row is TE1700. General coding agents for Structured Text is the page for GitHub Copilot, Cursor, and Claude Code on text exports. Those editors are not the Beckhoff changeset.

Site acceptance and functional safety

The five checks above still leave the machine. Site acceptance is the gate on the real equipment, with the plant's own change process. A procedure, a form, and a pass rate for AI-generated PLC code at site acceptance: Not stated on the Fraunhofer pages or the vendor pages opened for this guide.

IEC 61508-1:2010, on the IEC webstore, covers those aspects to be considered when electrical, electronic, or programmable electronic systems are used to carry out safety functions. The page says it has the status of a basic safety publication according to IEC Guide 104. IEC 62061:2021 specifies requirements and recommendations for the design, integration, and validation of safety-related control systems for machines, and the page says it is a machinery-sector standard within the framework of IEC 61508. The same page shows a consolidated version with Amendment 1:2024. Its list of changes says this edition added requirements on independence for software verification and on validation activities. The text of those clauses: Not stated here. This page did not buy the standards.

Whether the MBO-KISS workflow, CODESYS Static Analysis, the Test Manager, the Simulation Interface, or TwinCAT CoAgent meets IEC 61508 or IEC 62061: Not stated. The Fraunhofer press release and the project page do not name either number. The TE1700 manual says CoAgent must not be used in functional safety applications. A safety function stays with the qualified safety process you already use. Connecting a model to a live controller is a different question, covered by is it safe to connect AI to a PLC?.

Feed the results back into generation

The project page says the results from the static and dynamic tests are incorporated into subsequent generation cycles, so the code is improved with each test run. The press release says the test results are then fed back into the generation process. That is the loop: the failure, not a fresh prompt, is the next input. SemaPLC's abstract says failed checks guide bounded repair, and that an edit invalidates the previous verdict. CycleBench's CycleGen repairs compilation errors with compiler feedback and then selects a candidate with runtime self-tests. The research comparison records verifier errors fed back for LLM4PLC, and a generate-and-improve loop for AutoPLC.

The error figure belongs to Fraunhofer IKS, in Fraunhofer's words. The press release of 6 November 2026 says: "According to Fraunhofer IKS, the number of errors in the scenarios it examined was reduced to one-tenth after several runs through the test workflow." The project page says: "After several rounds of the testing workflow, we have already reduced the number of errors to one tenth." The project page also says the generated control applications showed few errors when compared with the code style guide, and that these are initial interim results. The press release limits the one-tenth line to the scenarios Fraunhofer IKS examined. This page did not count those errors and does not treat either sentence as a rate for another plant, another model, or another language.

The project page says six partners take part. Fraunhofer IKS leads. It names ITQ GmbH for static and dynamic code analysis, Sepp.med GmbH for test automation, and Max Streicher GmbH & Co. KGaA for use cases and practical tests. The associated-partner line says: "Codesys Group and Bosch Rexroth AG are supporting the project as experts and consultants." The page does not say those two companies measured the one-tenth figure. The project period is January 2025 to December 2027. The press release says Fraunhofer IKS will present the work at SPS in Nuremberg on 24–26 November 2026, Hall 6, Booth 240. A product you can download from that booth: Not stated.

Use the loop in that order. Compile and run the static rules. Write a unit test for the block, and keep system behavior for the simulator and the machine. Simulate against a model of the equipment, including the scans a final-value check would skip. Read the changeset and accept only the lines you intended. Record site acceptance on the real machine. Put the failed check into the next draft. Then run the same checks again, because SemaPLC's point about an edit invalidating the last verdict is the reason the earlier pass does not carry over.

FAQ

Does a clean compile mean the AI-generated PLC code is correct?

No. The CycleBench abstract, arXiv:2610.28675, opened 23 November 2026, says that across eight LLMs and baseline methods, execution pass rate trails compilation by 11.92 percentage points. Fraunhofer IKS still runs unit tests and a 3D simulation after static analysis. The research comparison says a compiler pass is not an acceptance test. This page did not rerun CycleBench.

What error reduction does Fraunhofer IKS report?

The 6 November 2026 press release says: "According to Fraunhofer IKS, the number of errors in the scenarios it examined was reduced to one-tenth after several runs through the test workflow." The project page says: "After several rounds of the testing workflow, we have already reduced the number of errors to one tenth." Both lines are Fraunhofer IKS's. This page did not rerun the scenarios.

What is the CODESYS Test Manager?

The CODESYS store page, opened 23 November 2026, says it runs system-level tests of applications and unit tests of function blocks, and that unit-test steps are programmed in any IEC 61131-3 language. The unit-test help says a unit test cannot be used for system test scenarios. A separate Test Manager price: Not stated; the page lists the Professional Developer Edition from €550.00. This page did not run a test.

Does TwinCAT CoAgent apply PLC changes before review?

The TE1700 manual, version 0.5.2 dated 19 November 2026, says POU changes stay in a chat-specific workspace until you click Accept. A setting named Write PLC changes directly writes them immediately and reviews afterward. The same manual says CoAgent must not be used in functional safety applications. A public license price: Not stated on the product page or the 23 June 2026 press release.

Does this workflow meet IEC 61508 or IEC 62061?

Not stated. The Fraunhofer press release of 6 November 2026 and the MBO-KISS project page do not name IEC 61508 or IEC 62061. The IEC webstore describes 61508-1:2010 as a basic safety publication for E/E/PE safety functions, and 62061:2021 as the machinery standard inside that framework. Neither page says an AI compile-test-simulate loop meets the standard.

Does Siemens Eigen check control code beyond a compile?

The 24 November 2026 milestone release says Eigen can verify whether control code behaves as intended and can identify errors that compilation alone may not detect. Siemens says this is available to Eigen customers at no additional charge during an introductory period, with a paid offering planned in the coming months. A price and an end date: Not stated. Whether the PCS 7 edition includes the same check: Not stated. This page did not run it.

Should failed checks go back into the next draft?

Fraunhofer IKS's project page says the results of the static and dynamic tests are incorporated into subsequent generation cycles. The 6 November 2026 press release says the test results are then fed back into the generation process. The research comparison records the same shape for LLM4PLC, Agents4PLC, and AutoPLC. A later draft still needs the human review and the site gate.

Sources

Fraunhofer, CODESYS, Beckhoff, IEC, CycleBench, and SemaPLC pages opened 23 November 2026. The TE1700 manual file is version 0.5.2, dated 19 November 2026. The Beckhoff press release is 23 June 2026. The Fraunhofer press release is 6 November 2026. Quote Fraunhofer's error lines as written. The research comparison was not re-measured; its date on that page is 12 November 2026. The Eigen milestone release was opened 24 November 2026.