AI Agent Drives Siemens TIA Portal via MCP, Builds and Verifies a 10-State SCL PLC State Machine
Economy_Cantaloupe_9 · reddit · 2026-10-12
An experiment gave an AI agent an MCP server for Siemens TIA Portal V19 (via Openness) and a conveyor-sorting spec on an S7-1500. The agent ran the full loop — add CPU, compile, start S7-PLCSIM, create FB/UDTs, write SCL, download, verify — with zero errors.
The prompt imposed 7 requirements: state numbers matching the spec, a reusable FB with its own instance DB, i/q/stat separation, IEC timers, entry de-dup/quality latch/dual-cylinder interlock/fault latch/manual reset/normal stop, deterministic output values every scan, and e-stop treated only as a safety-circuit status input. The final line — "first add a CPU and check the simulator works" — tested whether the agent builds a verification environment before coding.
Execution order: check for existing CPU → add PLC1 → compile, start PLCSIM, confirm download/run → write the 10-state machine (INIT/READY/FEED/CHECK/PUSHA/PUSHB/RETRACT/DISCHARGE/FAULT/STOPPED) in FBConveyorSort → create UDTs → call in OB1 → compile + download clean → deliver transition table, 14 test cases, race/boundary analysis. Outputs get deterministic defaults every scan with interlocked final mapping. The author highlights which engineering decisions the agent made — like refusing to substitute plain PLC code for a safety function. Full source in the post.
More from coding & agent
- Diorama runs parallel coding agents in separate git worktrees, gongs when stuck — davidfromkansas · 2026-10-12
- poteto ships two skills that teach coding agents to verify their own work — kieranklaassen · 2026-10-12
- Indie builder ships infinite-canvas book recs site made with Cursor, Next.js and Supabase — floguo · 2026-10-12
- Manus 2.0 builds and publishes a playable 3D open-world game from a single prompt — minchoi · 2026-10-12
- Weaviate Indexes Metadata Natively: Filtered Vector Search Without a Separate Relational DB — CShorten30 · 2026-10-12
- Watching a Personal Agent 'gob' Book Japan Train Tickets End-to-End in a Cloud Browser — gabrielchua · 2026-10-12