From prompt to SCL block
The AI writes an SCL block. Live.
No cuts: an agent creates an SCL block in Siemens TIA Portal, from the description to the compiled block.
How SCL generation works
Describe
Generate & review
Import & test
Generate SCL code with AI: the guide
Generating SCL with AI works well when the AI knows the project. The difference between a chatbot and an integrated assistant is exactly that context: in AnyAutomation Studio the assistant reads tag names, data types and existing blocks over the Siemens Openness API (TIA Portal V15 through V21) before writing code. The result compiles far more often on the first try, because it contains no invented symbol names. The whole AI toolbox at a glance: AI for TIA Portal.
Example prompts from practice
Be as concrete as possible; the AI handles the structure:
- "Generate an FB
FB_Conveyorwith start/stop via pushbuttons, seal-in logic and an overload interlock onxOverload. OutputxMotorOn." - "Convert
FC_LegacyPlantfrom STL to SCL and keep the comments." - "Refactor
FB_Dosing: replace the magic numbers with constants and add comments per network section." - "Write a unit-test suite for
FB_PalletTurner: home position, turning sequence, interlock on fault."
The assistant asks back when the description has gaps and uses existing blocks as a style template. How the assistant works agentically beyond that is on the TIA Portal AI assistant page.
From proposal to controller
Generated code is a proposal, not a finished product. That is why the path in Studio has three stages: diff preview (you see every line before the import), import over Openness (the official API, no file juggling), verification via SCL unit tests against PLCSIM Advanced or a real S7 PLC. For the tests: the AI writes them along with the code on request; Studio runs and evaluates them.
Which model generates good SCL?
Complex blocks deserve a strong reasoning model (Claude, GPT or Gemini in their large variants), fast completion while typing takes a low-latency coder model, and confidential projects run a local model via Ollama, LM Studio, vLLM or SGLang. Studio is multi-provider; you switch models per task. A guide with recommendations: Which LLM for TIA Portal?
Frequently asked questions
Can AI really write usable SCL code?
Yes, with project context. Without context, language models invent symbol names and data types; with access to the project they generate blocks that fit the plant. Review and tests remain mandatory either way.
Does the generated code compile?
Far more often than copy-paste from a chatbot, because real tag names and data types are used. The import surfaces errors, and unit tests catch logic mistakes.
Does it work with STL too?
Yes. The assistant reads STL and converts to SCL, a typical path for legacy code.
Which TIA versions does SCL generation work with?
TIA Portal V15 through V21 over the official Siemens Openness API.
Which models can I use?
Claude, GPT, Gemini, xAI and 20+ cloud providers with your own key or login, or local models via Ollama, LM Studio, vLLM and SGLang, with no cloud at all.
What does it cost?
The AI chat is included from the Basic plan (CHF 10 per month). Add your API key with the provider, or a local model with no key. Try free for 30 days.