AI in PLC Programming – artificial intelligence is moving into the daily work of PLC programmers. In this post we show how to connect TIA Portal with Claude Code through TIA Portal Openness, so the AI can read and modify your automation project — generate code, import tags, convert programming languages, and move entire libraries between projects.
This is a step-by-step guide based on our workshop. Each step includes a screenshot from the exact moment in the demo.

Why connect Claude Code with TIA Portal?
Hand-written tag tables don’t scale across plants, and the classic workflow means hundreds of clicks. Here, a conversation with AI replaces the click-heavy work:
- Claude writes SCL / XML / Excel, and our tool pushes the data into TIA Portal in seconds.
- Sub-minute round trip from “idea” to “compiled block.”
- Applies to code generation, import, export, refactoring, and library migration.

Prerequisites
Set up your environment before you start.
Software:
- TIA Portal V20 (or newer) + TIA Portal Openness
- .NET Framework 4.8 Developer Pack
- Visual Studio 2022 or the
dotnetCLI - Claude Code CLI (authenticated)
System:
- Windows user in the “Siemens TIA Openness” group
- Same UAC level as TIA Portal
- Openness DLL at the expected path
- PowerShell running as administrator for first-time setup
TIA Portal Openness is the API to TIA Portal — it ships with the full TIA Portal package, so there’s nothing extra to download. Claude Code requires a paid plan to work at this scale.

Step 1 — Enable TIA Portal Openness (3 commands)
You only need three commands to enable Openness. Without this, every API call throws an EngineeringSecurityException.
1. Verify the DLL path — this is the key file we communicate with TIA Portal through:
C:\Program Files\Siemens\Automation\Portal V20\PublicAPI\V20\Siemens.Engineering.dll
2. Add your user to the group (admin PowerShell):
net localgroup "Siemens TIA Openness" "%USERNAME%" /add
3. Verify after logout / login that you have the rights:
whoami /groups | findstr /i Openness

What is TIA Portal Openness?
You know the standard graphical TIA Portal interface — project tree, code editor. Openness is the programmatic interface that lets you reference those same project elements from code.
Every element (blocks, tags, data types) is named, so you can address it directly through the library. There are C# (richer, more functions) and Python (fine for basic tasks) libraries available.

What Claude can do in TIA Portal
A dozen-plus use cases we demonstrated in the workshop:
- Import 200 tags from Excel (no manual typing)
- Generate global DBs from a sheet or a Word document
- Write FBs from plain English
- Import UDTs and whole libraries between projects
- Export a block to SCL format
- Organize blocks into folders / subgroups
- Sanitize multi-lingual comments
- Translate ladder logic (LAD) semantics to SCL
- Generate state machines (CASE OF)
- Document blocks to Markdown
- Compare project signatures
- Batch-rename tags
- Create instance DBs from function blocks
- Commit generated code to Git
- Dry-run before destructive changes — check first, write only after

The ControlByte TIA Copilot framework — modes
On top of Claude Code we built a framework with ready-made modes (skills) you run from the command line:
| Mode | What it does |
|---|---|
--excel | Import tags + global DBs from an .xlsx file |
--scl | Import .scl source as FB / FC / UDT / DB |
--xml | Batch-import SimaticML XML (culture-aware, multi-pass) |
--export-scl | Pull blocks / UDTs out of TIA to .scl |
--organize | Move blocks / UDTs into subgroups by name prefix |
--list-projects | List every open TIA instance and its projects |

Demo — step by step
Step 2 — Launch Claude Code next to TIA Portal
Open Claude Code (the Windows app) and at least one TIA Portal V20 instance with a project.

Step 3 — List the open TIA instances
First prompt for Claude:
Hey Claude, please list the open TIA Portal instances for me.
Claude uses our Openness-based skills and returns a table with PID, project name, and path. Here you can see two running instances and a prompt asking which one you want to work on.

Step 4 — Open a project and list the robotic stations
Please open the first project robots01_done_template and list the robot stations coded into this project.
Claude analyzes the project structure and returns the list of stations — function block names, instance DBs, and the call structure. In this example it detected two robotic cells.


The project comes from our TIA Portal programming course with Factory IO simulation — a robotic station, conveyors, and a sorting station.

Step 5 — Export a function block to SimaticML (XML)
The FB_Robot block is written in ladder logic (LAD) and implements the PackML standard for the whole cell. Export it to XML — manually (right-click → export as SimaticML) or by asking Claude to do it.

After export, the whole block is described in XML — you no longer see the ladder graphics; everything is structured. That’s ideal input for the AI.

Step 6 — Let Claude analyze the block
Could you read FB_Robot and analyze the function block? Tell me what you see there.
Claude reads the XML file and describes the block’s interface, the networks (with titles), and the logic coded in each network.

Step 7 — Convert LAD → SCL
Claude, please convert the ladder logic into SCL and save the file into the folder I will give you.
Each ladder network is rewritten into the text-based SCL language, together with the variable declarations. The result is a FB_Robot_From_LAD.scl file.

Step 8 — Import the whole station into a new project
Open a new, empty project and ask Claude to import all the station files:
I have a new TIA Portal project opened, sample_project_w1. Please import all the files for the robotic station from the import folder - and remember to import the robot function block in SCL, not in ladder logic.
While the API works, the project is locked, and the tree fills with organization blocks, functions, function blocks, and PLC data types (UDTs) — including PackML types and the robot data types.

Step 9 — Compile and verify
Finally, Claude compiles the project to check that all data types, tags, and variables are defined. If something is missing (e.g. an omitted UDT), the errors show up right away.


Summary
During the workshop we:
- Connected to TIA Portal through TIA Portal Openness and Claude Code.
- Read the project data and analyzed a function block written in LAD.
- Converted the ladder logic into SCL.
- Imported the entire robotic-station framework into a new project.
The next step is to call the function blocks with the proper instances for each station. With 2 stations you do it by hand, but with 20 — Claude Code generates the instances for each station from your block and framework.

Want more?
If you’re curious about AI in automation, check out our courses and materials:
- Website: controlbyte.tech
- YouTube: ControlByte Automation



