Digital AI28 October 20269 min read

Can AI Write PLC Code? What ChatGPT Gets Right and Wrong

Can AI write PLC code? Yes, often as readable Structured Text, but it needs expert review and simulation, and never safety functions.

AI for PLCChatGPTstructured textPLC programmingSiemens TIA Portalautomation
Woman engineer working on a laptop at a mechatronics test rig with wiring harnesses and sensors

Key takeaways

  • A 2023 ABB Research study (arXiv 2305.15809) found GPT-4 produced syntactically correct Structured Text in many cases, and also said answers need careful validation by experienced control engineers.
  • Siemens now sells Eigen Engineering Agent for TIA Portal V19, V20 and V21, with a free one-month trial; its speed and quality claims come with no method on the page.
  • Use a review checklist: compile, map the I/O, check interlocks and fail-safe states, simulate first, use version control and get sign-off from a competent person.
  • Never delegate safety functions to AI, and check your contract and data terms before pasting client code into a cloud tool.

Can AI write PLC code? Yes: large language models can produce readable IEC 61131-3 Structured Text and vendor tools can generate SCL and ladder. But the output needs line-by-line review and simulation by a competent engineer before it goes near a machine, and AI must never be relied on for safety functions.

Checked 28 October 2026. We read the 2023 ABB Research paper on arXiv (2305.15809), Siemens's product page and May 2025 press release, and the NCSC's AI guidance. We did not run a test of our own for this post, so nothing here is a claim about how accurate any tool is today.

The short answer: boilerplate yes, unattended no

AI is useful for first drafts, comments, test ideas and explaining old code. It is not a substitute for knowing the machine. The one thing the best evidence agrees on is that a person has to check the result. The rest of this post sets out what the research found, what vendors now sell, a checklist you can use, and what to keep out of a cloud tool.

What did the research find?

The best-known study is "ChatGPT for PLC/DCS Control Logic Generation" by Heiko Koziolek, Sten Gruener and Virendra Ashiwal of ABB Research, posted on arXiv on 25 May 2023 (arXiv:2305.15809). It is a preprint, not something we can call peer reviewed. The authors wrote 100 prompts in 10 categories and ran them through ChatGPT using GPT-4, asking for IEC 61131-3 Structured Text. The abstract says the model "generated syntactically correct IEC 61131-3 Structured Text code in many cases" and showed useful reasoning.

The paper is more cautious than the headlines built on it. In its own findings and threats-to-validity sections, the authors say:

  • "ChatGPT answers require careful validation": answers can look correct but "contain subtle errors or omissions", and syntax problems are easy to spot by compiling, while semantic problems "may be harder to find".
  • "Oversight of experienced control engineers is still required."
  • "Many of the answers have not yet been compiled and thoroughly checked for functional correctness", and the quality scoring was informal.
  • The generated code used newer language features, such as methods, that "may not be supported by all PLC environments".
  • Text-based attempts at graphical notations such as function block diagrams "largely failed".
  • Output was usually limited to "one or two screens" of code, and in many cases it could be faster for an experienced engineer to write the Structured Text directly.

This was GPT-4 in 2023, and it was an exploratory study, not a safety assessment. It tells you what was possible then. It does not tell you how any model performs today on your platform.

What do vendors offer now?

Siemens is the clearest example. A Siemens press release dated 12 May 2025, announced at Automate 2025, lists Industrial Copilots including an Engineering Copilot "Available for TIA Portal with Managed Service coming in 2025", able to "generate automation code through natural language inputs", with SCL code generation named. It says "Users retain complete control, selecting which tasks they wish to delegate to AI agents." The release does not use the word "beta".

When we opened the Siemens product page on 28 October 2026, the address we followed, which still contains "engineering-copilot-tia-standard", redirected to a page titled Eigen Engineering Agent. The page says it is connected to TIA Portal and "supports SCL and LAD generation by creating or adapting code, generating test logic, and fixing compile or syntax errors". It also covers HMI scripting, drive configuration and hardware and network configuration. To use it you need a licence for TIA Portal V19, V20 or V21 and an Industry Organization Account, and the page offers a free one-month trial.

Siemens's page carries marketing claims of 2 to 5 times faster execution and "Up to 80% higher solution quality". It gives no method or sample for them, so we do not treat them as evidence. It is a vendor's own description of its own product.

An engineer studying data and terminal output on a large monitor in a dim room
An engineer studying data and terminal output on a large monitor in a dim roomPhoto: Mikhail Nilov, Pexels License, via Pexels

An engineer reviewing output on a screen is the right picture for this stage: the tool proposes, a person checks.

For a short look at what a vendor demonstration shows, here is Siemens's own video, which is promotional and about 2024's Industrial Copilot branding.

Siemens Industrial Copilot: Your generative AI-powered assistant across the value chain

What does AI do well, and where does it fail?

Does well:

  • Drafting structure: a state machine skeleton, a function block shell, or a routine for scaling an analogue value.
  • Writing comments and documentation for code you give it.
  • Suggesting test cases, and explaining unfamiliar or legacy logic.
  • Translating between styles, which the Koziolek paper reports in its programmer-support examples.

Fails or needs care:

  • Platform quirks. Instruction names, data types and library calls differ between Siemens, Rockwell, CODESYS and others, and a model can produce a plausible instruction your platform does not have.
  • Timing and scan behaviour. A model does not feel scan time, interrupt priority or a slow device.
  • Interlocks and fail-safe states. It does not know what your machine does when air pressure drops or a sensor fails.
  • Your plant's tags and I/O. It only knows what you tell it.
  • Safety. See below.

A 10-point review checklist before anything runs

  1. Read every line. If you cannot explain it, do not download it.
  2. Compile it on the target platform and fix every warning, not only errors.
  3. Map the I/O. Check every address and tag against the I/O list and drawings.
  4. Check interlocks and permissives. Confirm what must be true before each output turns on.
  5. Define fail-safe states. Power loss, comms loss and a broken wire should leave the machine safe.
  6. Keep safety out of AI hands. Safety functions are designed and validated separately.
  7. Check timing. Timers, scan assumptions and handshakes with other devices.
  8. Simulate first. Use a simulator such as the one built into your vendor's software, or an open runtime, with forced inputs, before any physical machine. Our free AI for PLC programming course shows how to do this safely.
  9. Use version control and keep the prompt with the code, so you can see what was asked and what changed.
  10. Get sign-off from a competent person, and test on site under your normal permit and commissioning procedure.

Why must a person sign off safety functions?

A safety function, such as an emergency stop, a guard interlock or a light curtain, is not ordinary control code. Standards such as ISO 13849 (safety-related parts of control systems) and IEC 62061 (functional safety of machinery control systems) set out how such functions are specified, designed and validated, and that means documented design and verification by people who are accountable for it. A model producing plausible code is not that process. We do not quote clauses or performance-level numbers here because we could not read the standards, which are sold. Our free machine safety, ISO 13849 and SISTEMA course explains the ideas.

A factory machine line with a touchscreen control panel, a red emergency stop button and yellow safety sensor boxes along the frame
A factory machine line with a touchscreen control panel, a red emergency stop button and yellow safety sensor boxes along the framePhoto: Homa Appliances, Unsplash License, via Unsplash

The red emergency stop and the yellow safety sensor boxes in this photograph are exactly the equipment whose logic must be designed, validated and signed off by people, not generated and pasted in.

Is it safe to paste client code into an AI tool?

Not without checking. The NCSC's "AI and cyber security: what you need to know", published 13 February 2024, does not mention PLC code or say "do not paste code". What it does say bears on the question: it tells managers to be aware of AI-specific concerns around data security and to understand whether their organisation handles AI-related data in line with compliance requirements, and it warns that attackers can craft inputs to make a model reveal confidential information. From that, our own advice, which is not NCSC's wording, is to treat code, tag lists, network details and drawings from a client as confidential unless your contract and the tool's data terms clearly allow sharing, and to ask your client first.

What does this mean for a PLC career?

The evidence above points the same way: AI changes how fast a competent engineer drafts, and raises the value of someone who can review, simulate and commission. The Koziolek paper itself says experienced engineers are still required. It does not say jobs will or will not change, so we will not make a claim either way. A sensible plan is to learn the fundamentals first, then use AI as an assistant you check.

If you want a first look at the code side without a tool, try the free Siemens SCL and Structured Text course for TIA Portal. For a different video view, this tutorial from LEARNACON shows one person generating PLC code with AI for TIA Portal. It is one demonstration by a trainer, not a benchmark.

How to generate PLC code with AI for TIA Portal (LEARNACON)

Start free

Learn the language before you lean on a tool: start with the free AI for PLC programming course and the free Siemens SCL course, then try days 1 to 5 of the PLC Programmer job simulation. A job simulation is practice, not employment. When you want to see what employers ask for, browse the PLC programmer role page. For the language basics, read our comparison of ladder logic and Structured Text. Nothing here promises a job, and no AI-written code is safe until a competent person has reviewed and tested it.

Start free

Learn generative AI for engineers free, then practise the job

Free job simulation

AI and LLM Application Engineer

Build and evaluate an LLM assistant, then handle a prompt-injection incident.

The first five days are free, no card needed.

Live UK jobs

Generative AI jobs in the UK

Updated daily, with licensed visa sponsors marked.

Browse all engineering jobs

Frequently asked questions

Can ChatGPT write PLC code?

It can draft Structured Text, and a 2023 ABB Research study found GPT-4 produced syntactically correct IEC 61131-3 code in many cases. The authors also say answers need careful validation by experienced engineers, so treat output as a draft.

Can Claude AI write PLC code?

Any general chat model can draft PLC code, and the same cautions apply to all of them. We did not test Claude or any other model for this post, so we make no claim about its accuracy. Review, compile and simulate everything.

Is AI-written PLC code safe to run on a machine?

Not until a competent person has reviewed, simulated and tested it. Safety functions should never be delegated to AI. They need documented design and validation under the relevant machinery safety standards.

What is the Siemens Engineering Copilot for TIA Portal?

Siemens announced an Engineering Copilot for TIA Portal in May 2025. On 28 October 2026 its product page presented Eigen Engineering Agent, which needs a TIA Portal V19, V20 or V21 licence and supports SCL and ladder generation.

Should I paste client PLC code into an AI chatbot?

Check your contract and the tool's data terms first. The NCSC's AI guidance tells managers to understand how their organisation handles AI-related data, and warns that models can be made to reveal confidential information. Ask your client before sharing.

Sources

  1. arXiv 2305.15809: ChatGPT for PLC/DCS Control Logic Generation, Koziolek, Gruener and Ashiwal (ABB Research), 25 May 2023
  2. Siemens: Eigen Engineering Agent for TIA Portal (read 28 October 2026)
  3. Siemens press release: Siemens introduces AI agents for industrial automation (12 May 2025)
  4. NCSC: AI and cyber security, what you need to know (13 February 2024)

Share this article

About the author

EDWartens Team

EDWartens Instructional Team

The EDWartens instructional team brings together UK-based automation engineers, certified Siemens and Rockwell specialists, and industry practitioners with decades of combined experience in PLC programming, SCADA engineering, and industrial AI.

View all articles by EDWartens

Ready to become job-ready?

Start with a free course today, or train live in Siemens PLC, HMI and SCADA on the Professional Module.