AI Structured Text (IEC 61131-3): deterministic verification before PLC deployment
Plain-text IEC 61131-3 Structured Text (ST) looks easy for language models to draft, yet syntactic validity never guarantees safe machine behavior. Because PLCs execute cyclically with latching coils, edge triggers, and mutual hardware interlocks, AI-assisted ST workflows require deterministic DS2 compilation, static causal checks, and 3D virtual cell verification before any engineer imports code into a vendor PLC IDE.
On this page
Why syntactically valid AI Structured Text still breaks real PLC machines#
Unlike web code that runs once per HTTP request, IEC 61131-3 Structured Text evaluates every line repeatedly inside a bounded real-time scan cycle. When an AI assistant generates raw ST directly from a chat prompt, it routinely omits opposite-motion interlock guards, resets timers mid-sequence, or assumes blocking loop semantics that freeze a physical controller. Compiling a compact DS2 control specification first eliminates prompt-to-prompt drift and catches missing interlocks before ST or PLCopen XML is ever emitted.
| Failure Class | Raw Prompt-Generated ST Risk | DS2 Static & 3D Gate Check | Operational Impact |
|---|---|---|---|
| Mutual Actuator Interlock | Forward/reverse or clamp/unclamp coils energized together | Static causal exclusivity and state-machine conflict checks | Prevents mechanical collision before controller download |
| Cyclic Scan & Watchdog | Blocking WHILE loops or unbounded wait states stall scan | Scan-deterministic transition lowering without blocking loops | Preserves predictable real-time PLC cycle timing |
| Edge Trigger & Latch Reset | Level-triggered start restarts motion after fault clear | Explicit BOOL pulse semantics and guarded reset transitions | Eliminates unexpected restarts during recovery |
| Cross-Discipline Drift | ST variable names diverge from HMI, wiring, and AAS tags | Single DS2 revision emits ST, PLCopen XML, 3D, and AASX | Keeps control logic, simulation, and asset records synced |
Checking scan-cycle determinism, edge triggers, and structured outputs#
A verifiable AI PLC pipeline treats Structured Text as a deterministic compiler target rather than a free-form chat artifact. From one reviewed DS2 model, DS Studio derives structured IEC 61131-3 ST and PLCopen XML deliverables where input sampling, mutually exclusive step transitions, timer watchdogs, and output latching follow explicit scan semantics across DualSoft's 10 published process line examples.
(* Non-blocking scan transition with mutual interlock guard *)
IF bAutoMode AND bPartAtEntry AND NOT bClampRetractCmd AND NOT bFaultActive THEN
bClampAdvanceCmd := TRUE;
ELSIF bClampAdvancedSensor OR bFaultActive OR NOT bAutoMode THEN
bClampAdvanceCmd := FALSE;
END_IF;
tClampWatchdog(IN := bClampAdvanceCmd AND NOT bClampAdvancedSensor, PT := T#3S);
IF tClampWatchdog.Q THEN
bFaultActive := TRUE;
bClampAdvanceCmd := FALSE;
END_IF;| Verification Layer | Target Property | Deterministic Check | Failure Handling |
|---|---|---|---|
| Syntax & Type Binding | Declared BOOL, TIMER, and I/O symbols | Static lexer, parser, and symbol resolution | Rejects undeclared tags or type mismatches immediately |
| Causal Interlock Rules | Opposing cylinders, lifts, and conveyor zones | Mutual-exclusion and reachability graph checks | Blocks compilation when conflicting motions overlap |
| Scan & Edge Semantics | Non-blocking transitions and explicit pulse edges | Zero-allocation deterministic scan kernel check | Prevents infinite loops and unintended re-triggers |
| Multi-Artifact Parity | ST, PLCopen XML, 3D twin, and AASX tags | Single compiled IR shared across all exporters | Eliminates manual spreadsheet tag drift |
3D virtual verification (SILS) and engineer-gated physical commissioning#
Offline code inspection alone cannot confirm spatial clearance or conveyor transfer timing. Running the compiled model inside DS Studio's 3D virtual cell validates step sequencing visually before export, while keeping truth boundaries explicit: public read-only MCP discovery (10 tools) never writes to live machines, vendor PLC IDE import (Vendor PLC IDE import not executed Not yet checked) is verified per target project, and physical hardware commissioning (Physical commissioning outside this reference scope Not yet checked) plus certified safety relays stay strictly under qualified site engineers.
| Commissioning Gate | Verification Scope | Owner | Public Evidence Status |
|---|---|---|---|
| DS2 Static & Scan Check | Interlock exclusivity, symbol types, scan determinism | DS Studio Compiler | Automated offline check per model revision |
| 3D Virtual Cell (SILS) | Visual workpiece flow, cycle order, timeout behavior | Control Engineer | Verified in browser/offline 3D twin before export |
| Vendor PLC IDE Import | Target vendor project import, hardware mapping, compile | Control Engineer (per site) | Vendor PLC IDE import not executed Not yet checked |
| Physical Hardware & Safety | Hardwired E-stops, safety PLC, physical I/O checkout | Site & Safety Engineer | Physical commissioning outside this reference scope Not yet checked |
Comparison Matrix: Ad-Hoc LLM Structured Text vs DualSoft Verified DS2-to-ST Pipeline#
| Evaluation Criterion | Ad-Hoc Chat LLM to Raw ST | DualSoft DS2 -> Verified ST & 3D | Why It Matters on the Floor |
|---|---|---|---|
| Interlock Safety Checks | Manual code review only | Static causal compiler checks before export | Stops conflicting cylinder/drive commands early |
| Scan-Cycle Determinism | Risk of blocking loops and level-trigger bugs | Non-blocking scan semantics & watchdog timers | Keeps real-time PLC cycle bounded and predictable |
| Pre-Download Validation | No physical/spatial motion feedback | Synchronized 3D virtual cell verification | Catches transfer and sequence flaws off-machine |
| Vendor & Asset Traceability | Unlinked text snippets per prompt | Unified ST, PLCopen XML, OPC UA, and AASX | Single reviewed revision across control and IT |
| Safety Circuit Boundary | Blurred role between AI code and safety | Certified safety relays strictly outside AI scope | Clear compliance and engineer accountability |
Core Pillar & Related Briefings#
AI PLC Architecture Pillar All Engineering Insights Agentic AI factory safety: enforcing hard separation from real-time PLCs MCP for industrial PLC automation: read-only discovery with strict safety separation
Verified Facts and Scope Boundaries#
- Published process examples10
Interactive process-line examples published on dualsoft.ai that open without local installation.
- Read-only discovery tools10
The public MCP endpoint provides discovery tools with read-only access.
- PLC engineering-tool importVendor PLC IDE import not executed Not yet checked
Importing a project directly into a specific PLC vendor's engineering IDE has not yet been tested.
- Physical equipment commissioningPhysical commissioning outside this reference scope Not yet checked
Physical factory wiring, commissioning, and safety acceptance are outside this software reference scope.
Scope and Verification FAQ#
Why is syntactic validation alone insufficient for AI-generated IEC 61131-3 Structured Text?
An ST compiler checks grammar and data types, but it does not know whether advancing a clamp while a lift is moving will crash the tooling. Deterministic DS2 causal rules and 3D virtual cell verification check physical interlocks, scan timing, and recovery transitions before code reaches a PLC.
Does Structured Text replace Ladder Logic in AI PLC engineering?
No. Many plant maintenance teams still inspect Ladder Logic on the shop floor while using Structured Text for complex state logic and data handling. Generating ST, Ladder views, and PLCopen XML from one reviewed DS2 model lets both disciplines stay aligned without manual rewrites.
Can an AI agent connect via MCP and download Structured Text directly to a live PLC?
No. DualSoft separates read-only specification and library discovery on the public Web MCP server from offline compilation and engineer-approved commissioning. Target vendor PLC IDE import and physical site acceptance remain human-gated engineering steps.
How do safety PLCs and emergency-stop relays fit into AI-assisted ST workflows?
Certified safety relays, hardwired emergency stops, and safety PLC circuits remain strictly outside AI authoring and MCP scope. AI-assisted modeling applies only to standard sequence control under qualified engineer review and site safety procedures.
Verified by: DualSoft Engineering — IEC 61131-3 Structured Text & Deterministic AI PLC Verification Briefing
Scope and deliverables are agreed together before any customer data is handled.





