[Guide 04] Designing Fast and Safely with AI Assistants & MCP
AI closed-loop optimization is a preview. Its real AI provider and DSL simulation backend are not connected yet, so optimization and Apply are disabled. This modal neither produces verified improvement KPIs nor writes HMI commands. Existing MCP DSL authoring, compilation and execution verification remain separate features.
AI Co-Design Guide (
DSDX-MCP/1.0)Describe your process in plain words; the AI reads the official rules first, writes
.ds2code, and proves it with real compiler receipts and scan traces.
1. The 4-Step Verified AI Loop
Step · What Happens · Why It Stays Reliable
1. Describe in Plain Words · *"Load a part, lock the clamp, drill both sides in parallel, and block manual jog if the safety door opens."* · No syntax memorization required.
2. Official Rule Lookup · Connected AI reads the official DS2-SPEC-V2.0 syntax cards before writing any line. {{Details::Docs-First Rule: Calls dsdx.start, docs_read, and dsdx.ai.probe to verify syntax rules first.}} · Eliminates guessed or hallucinated syntax.
3. Compiler & Trace Proof · AI compiles your draft with the real compiler and proves runtime behavior with execution receipts and multi-view reports. {{Details::Canonical Verdicts & 3-Round Check: Reports PASS, FAIL, INCONCLUSIVE, NOT_RUN, or UNSUPPORTED, defaults to 3-round verification with CALL-TOKEN-BOUNDARY-1 token isolation/borrowing, DS2-W002 sensing bounds, FiredEdgeIndices, and VENDOR_PLC SILS (unsupported calls/open-loop paths are rejected with GUARD-E422_UNSUPPORTED_OR_UNMEASURED / HOST-E422_CALL_EXECUTION_UNSUPPORTED) // Interactive Reports: Generates ds_studio_views.html and a 7-Tab V3 showcase HTML}} · Catches syntax errors or 2nd-cycle deadlocks automatically.
4. 3D Assets, Line Workbench & Export · Connects 1,345 public 3D models, PLC/artifact export (dsdx.artifact.export preflightAdvisories PREFLIGHT-W001..W005 / CAPABILITY_UNSUPPORTED), and .aasx bundles through 10 read-only public / 89 local privacy-safe MCP tools. {{Details::3D Explorer & Lines: Browse 1,345 models (1,258 .ds2-linked) and 10 industry line templates (01 Smartphone~10 Hydrogen Energy) // Zero-Exposure & VS Code: Public /mcp stays read-only (10 tools); all 89 tools run locally (--stdio / single .vsix v2.2.3, install:local Windows+WSL deploy, per-endpoint Direct AI key isolation)}} · Generates 3D scenes and .aasx bundles from the same .ds2 file.
💡 No MCP Tool Connection? Let any web chat AI read
/ai-start.txt, then paste itsUNVERIFIED_DRAFTinto PLAY Source Review to compile and verify safely.
2. Safety-Interlocked Lifter & Robot Example (ds2 v2;)
ds2 v2;
project SafetyInterlockStation {
active StationController;
system SafetyDoor {
flow Monitor {
work ClosedOk finished { duration 50ms; }
}
observe DoorOk = Monitor.ClosedOk;
}
system Lifter {
flow Lift {
work Up { duration 200ms; }
work Down finished { duration 180ms; }
Up <|> Down;
}
api Up = Lift.Up;
api Down = Lift.Down;
}
system StationController {
origin flow Homing {
work LifterInitialDown {
interlock (SafetyDoor.DoorOk) "Cannot move while safety door is open";
Lifter.Down reuse completed;
}
}
flow WorkLoop {
work LifterRaise finished {
when (SafetyDoor.DoorOk);
interlock (SafetyDoor.DoorOk) "Cannot raise lifter while safety door is open";
Lifter.Up;
}
work RobotProcess {
while (SafetyDoor.DoorOk);
duration 300ms;
}
work LifterReturnDown {
interlock (SafetyDoor.DoorOk) "Cannot lower lifter while safety door is open";
Lifter.Down;
}
LifterRaise => RobotProcess =|> LifterReturnDown;
LifterReturnDown |> LifterRaise;
}
}
}
3. Quick FAQ
Question · Short Answer
Can I deploy AI code straight to a PLC? · Always inspect the .ds2 model in PLAY first, and verify physical I/O wiring and hardware safety relays before loading onto a live PLC.
1-cycle vs. continuous loop? · Remove `LifterReturnDown \ · > LifterRaise;` to run just one cycle per start command.
What about ds2 v1; files? · They compile unchanged, or upgrade cleanly via {{lossless migration::dsdx.project.migrate (DSDX-MIGRATE-1) converts conditions and headers automatically.}}.
Where is setup & tool documentation? · Open the 6-tab non-scrolling AI Connection Guide (/mcp-guide) (Quickstart · Tools, Downloads, AI IDE Setup, VS Code Guide, Photo · MC · Factory, Tool Catalog) and the MCP Quickstart.