AI for CODESYS
How to work with AI on a CODESYS project
Give context
Review the proposal
Prove it
AI for CODESYS: tools, practice, limits
AI for CODESYS in 2026 means one concrete thing: a language model reads, writes, converts and explains Structured Text under IEC 61131-3, and a tool around the model makes sure the proposal fits the project and reaches the controller verified. The tools come from four directions. CODESYS itself offers, per the CODESYS documentation, AI-supported engineering inside its own development system and an MCP server for the CODESYS Development System that lets external AI clients work with the project. Next to that are chat and web tools such as PLC Assist (an AI chat beside the IDE, CODESYS among its targets) and SCLcode (a web generator, CODESYS among its targets). General chatbots such as ChatGPT, Claude or Gemini answer ST questions freely, but with no link to your project. And engineering IDEs such as AnyAutomation Studio open the CODESYS project and feed the AI chat with that context. This page sorts the four paths out. The vendor-neutral overview of every tool is in the comparison of AI tools for PLC programming.
What AI can do with Structured Text in CODESYS
Language models are text models, and Structured Text is text. That is why ST is the language in which AI works most reliably in the CODESYS world. Five tasks where it saves real time:
- Understand and document. The AI reads an unfamiliar POU, explains the logic, names states and interlocks, and writes the documentation for it. For existing plants this is the most common and lowest-risk entry point, because nothing is written.
- Generate. A description ("function block for a conveyor with start, stop, seal-in and an overload interlock") becomes a block in ST. The result only becomes usable once the AI knows the real identifiers and data types of the project.
- Convert and port. Move code between naming conventions, rebuild logic from another controller world as ST, derive a state machine from pseudocode. Pattern work where models are fast.
- Refactor. Replace magic numbers with constants, clean up interfaces, bring comments up to date, give a state machine that grew over the years a proper structure.
- Draft test cases and narrow down faults. The AI proposes test cases for a block, explains a compiler message, or narrows down an observed behaviour when you give it the information it needs.
What is missing from this list is missing on purpose: safety-related logic, hardware and fieldbus configuration without review, and anything that depends on assumptions about cycle time and peripherals. More on that below.
What CODESYS itself offers
The CODESYS Group has taken the vendor path. Per the CODESYS documentation it consists of three parts:
- AI-supported engineering in the IDE. Assistance functions inside the CODESYS Development System that help with writing and understanding IEC 61131-3 code.
- The MCP server for the CODESYS Development System. It exposes the project over the Model Context Protocol so that external AI clients can work with it. The upside: the choice of model is yours, because the client brings the AI. The price: installation, hardening and the gates around the generated code are the user's job.
- The CODESYS Test Manager. The vendor's own test tool for automated testing in the CODESYS environment, a separate product next to the IDE.
These statements come from public CODESYS sources and product descriptions; the vendor is authoritative. If something is out of date, write to support@anyautomation.ch and we will correct it.
What AnyAutomation Studio does with CODESYS today
AnyAutomation Studio is an engineering IDE for Windows that connects to CODESYS alongside TIA Portal V15-V21. The CODESYS side is deliberately built read-only and does this today:
- Open CODESYS 3.5 projects. Studio connects to your own, locally installed CODESYS development system on the same machine. Without a local CODESYS installation there is no CODESYS view, and the rest of Studio keeps working normally.
- Show the objects as a tree. Applications, devices, folders and program blocks appear in the same nesting as in CODESYS, with a filter and multi-selection.
- Open a block's code. Clicking a POU opens its Structured Text code in the editor, with syntax highlighting, declaration and implementation together, for viewing.
- Export as PLCopenXML. Studio writes one PLCopenXML file per object into your export folder, the open, vendor-neutral exchange format for IEC 61131-3 code. That lets you archive blocks, compare them, or take them into another tool.
- The AI chat works with that context. The AI checks the connection status, lists the objects of the open project, reads a block's Structured Text code to explain it or answer your questions about it, and opens it in the editor on request. For detailed ST work it hands the task to a dedicated CODESYS specialist that targets IEC 61131-3 and the CODESYS style rather than Siemens.
Just as clear is what Studio does not do on the CODESYS side today: it writes no code back into a CODESYS block, it does not compile, it does not download to a controller, and it runs no CODESYS unit tests. Editing a block and writing the change back to CODESYS is planned for a later version. CODESYS support is available from the Pro plan; during the trial and on the Basic plan an upgrade prompt appears instead.
Cloud or local: where may your CODESYS code go
In many companies this question decides whether AI is used at all. Three answers are possible. Cloud under your own contract: you use Claude, GPT or Gemini with your own API key, or an enterprise offering such as Azure OpenAI, Vertex AI or AWS Bedrock; the data goes to the provider under your terms. Vendor cloud: with an assistant run by the controller vendor, the request travels over that vendor's infrastructure. Local: a model via Ollama, LM Studio, vLLM or SGLang on your own hardware, where inference never leaves the machine. For confidential plants, protected block libraries and regulated industries the local option is often the only one that passes approval. AnyAutomation Studio supports all three paths and routes no request through a server of its own.
Limits
A language model does not replace an automation engineer, and generated ST does not belong on a plant unreviewed. Four limits apply regardless of tool:
- Invented blocks and library calls. Models occasionally hallucinate functions, parameters or libraries that do not exist in your installation. A compile in CODESYS catches that; a chat window does not.
- Timing and hardware. Cycle time, task configuration, peripherals and communication behaviour are yours to verify, not the model's to guess.
- Safety-related logic. Safety stays manual work with acceptance testing. Generate, yes, but only standard logic.
- Responsibility. A human signs off. Review and testing are not optional extras, they are the part that makes an AI proposal usable in the first place.
Whoever uses AI on a CODESYS project seriously treats it like a fast junior: lots of output, always read back.
Frequently asked questions
Is there AI for CODESYS?
Yes, on several paths. CODESYS itself offers, per the CODESYS documentation, AI-supported engineering and an MCP server for external AI clients. Next to that are chat and web tools such as PLC Assist and SCLcode, general chatbots with no project context, and engineering IDEs such as AnyAutomation Studio that open a CODESYS project and feed the AI chat with that context.
Can ChatGPT write CODESYS code?
ChatGPT explains Structured Text well and drafts usable scaffolds, but it does not know your project. Identifiers and data types are guessed, library calls are sometimes invented, and the path into the project is copy and paste. As a learning aid and for small, isolated blocks that works. Project work needs a tool that knows the objects in the project, and in every case a compile in CODESYS.
What is the CODESYS MCP Server?
Per the CODESYS documentation, a server that exposes the CODESYS Development System to external AI clients over the Model Context Protocol. It lets a coding agent of your choice work with the project instead of you copying code back and forth. The choice of model stays free; installation, hardening and the review steps around the generated code stay with you.
Does AnyAutomation Studio support CODESYS?
Yes, from the Pro plan. Studio opens CODESYS 3.5 projects through your local CODESYS installation on the same machine, shows the objects as a tree, opens a block's code for viewing, and exports objects as PLCopenXML. The AI chat works with that context. Details are in the CODESYS documentation.
Can the AI write into CODESYS?
No. The CODESYS side of AnyAutomation Studio is read-only today: show objects, view code, export as PLCopenXML. Neither you nor the AI writes code back into a CODESYS block from Studio, and nothing is compiled or tested there either. Editing and writing back is planned for a later version.
What does AI for CODESYS cost?
For the vendor tools the price follows the CODESYS Group's own offering, chat and web tools run as monthly subscriptions, browser chatbots start at a free tier. In AnyAutomation Studio the AI chat is included from the Basic plan (CHF 10 per month or CHF 110 per year), CODESYS support from Pro (CHF 30 per month or CHF 330 per year), and Pro+ costs CHF 50 per month or CHF 550 per year. Add your own API key with the model provider, or a local model with no key. Try free for 30 days.
Does this work with TwinCAT too?
No. TwinCAT is Beckhoff's engineering environment with its own tooling, including the vendor's TwinCAT Chat. AnyAutomation Studio connects to TIA Portal (V15-V21) and CODESYS 3.5, not to TwinCAT. Structured Text under IEC 61131-3 stays similar as a language, of course, but the tool chain does not.
Which models can I use?
In AnyAutomation Studio you pick the model per task: Claude, GPT, Gemini and more than 20 further cloud providers with your own key, or a local model via Ollama, LM Studio, vLLM and SGLang. A strong reasoning model pays off for complex blocks, a small one for quick questions, the local one for confidential projects. No request runs through an AnyAutomation server.
What AI can really do in PLC programming
Languages, context, cloud or local, limits and the path from prompt to controller: the guide for automation engineers.