Code generation for TIA Portal
TIA Openness code generation with AI
AI authors SCL blocks, the TIA Portal Openness API imports them, Studio compiles before rollout: programmatic instead of clicking block by block.
TIA Portal V15-V21 · FB, FC, DB, UDT · Windows 10/11
The SCL editor with FB_ConveyorControl open. Go to Symbol lists the regions and members of the block; typing latch filters the list and Enter jumps to the region Latch fault causes, and the breadcrumb shows the current region. Hovering a variable shows its type and the comment of its declaration, and F12 jumps to the declaration of bMotorOverloadOk.
From prompt into the TIA project
Generate
You describe the logic, the AI assistant produces SCL blocks with full project context.
Review and confirm
The proposal arrives as a diff. You read it, adjust it and approve it.
Import over Openness
The official Openness API brings the blocks straight into the project, no manual copying.
Compile and test
Compile against the real project, then SCL unit tests on PLCSIM Advanced or the real PLC.
Contents
TIA Openness is Siemens' official programming interface (API) for TIA Portal. Through it, projects, blocks and configurations can be read, written, exported and imported programmatically: the basis for generating SCL code instead of creating every block by hand in TIA Portal. What the AI behind it can do, and where its limits are, is in the guide AI for PLC programming.
How does code generation work?
AnyAutomation Studio combines AI with the Openness API into one end-to-end flow: the AI assistant produces SCL blocks (FB, FC, DB, UDT) with full project context, the Openness API imports them straight into the TIA project, and Studio compiles the result against the real project before anything is rolled out. Repetitive, schematic code (typicals, standard blocks, interfaces) comes together in a fraction of the time.
Bulk export, folder structure and typicals
Generating pays off most when there are many blocks. You export whole block groups with their folder structure, have them generated or reworked, import them again and compare the result after the import. Reusable block types (typicals) are captured with Forge from any project into a block type library, and you roll the whole library out to a PLC.
Generate, import, verify
Generated code is only useful once it provably works. So the loop closes: AI generates → Openness imports → SCL unit tests verify against PLCSIM Advanced or real hardware → Git and CI/CD track every change. More on the AI in AI integration, more on Openness in the introduction.
Frequently asked questions
What is TIA Openness?
TIA Openness is Siemens' official API for TIA Portal. It lets you read, write, export and import projects and blocks programmatically, instead of doing everything manually in the TIA Portal UI.
Can AI generate SCL code for TIA Portal?
Yes. The AI assistant in AnyAutomation Studio generates SCL blocks with full project context on confirmation and imports them into the project via the Openness API. The code is compiled before deploy.
Which TIA Portal versions are supported?
Openness automation runs with TIA Portal V15 to V21 on Windows 10/11 (64-bit).
Is generated code compiled before rollout?
Yes. Studio compiles generated code against the real project before it reaches a PLC. Errors surface early, not on the controller.
How does code generation relate to unit tests?
Generated blocks can be verified straight away with SCL unit tests against PLCSIM Advanced or real hardware, generate and prove in one continuous workflow.
What is SimaticML?
SimaticML is the XML format TIA Portal uses to export and import blocks, including graphical languages such as LAD and FBD. SCL can also be imported as an external source. How to generate blocks in series with both formats is in the post SimaticML and external sources.
Try it now
Try code generation yourself
Try AnyAutomation Studio free for 30 days, no credit card. For TIA Portal V15-V21 and CODESYS 3.5.
Free account required: sign in with your email address and a code, then the download starts.
Questions? support@anyautomation.ch