Simulate PLC programs in Structured Text (IEC 61131-3) directly in VS Code — no hardware needed.
Open a .st file, run the simulator, and interact with your program in real time. Free forever for learning and prototyping. Pro unlocks the tools you need for serious work.
Get started in 3 steps
1. Install PLCSim from the VS Code Marketplace.
2. Open the PLCSim panel from the Activity Bar (sidebar icon). Load one of the built-in examples or open your own .st file.
3. Run the simulator and interact in real time — toggle inputs, change values, watch outputs react. No compilation, no deploy, no hardware.
→ Full documentation at plcsim.appscat.cat
Free — Full IEC 61131-3 Syntax & Simulator
Write and run complete Structured Text programs without restrictions.
Language (IEC 61131-3 Edition 3)
| Feature | |
|---|---|
| Scalar types | BOOL · SINT INT DINT LINT · USINT UINT UDINT ULINT · REAL LREAL · TIME DATE TIME_OF_DAY DATE_AND_TIME · STRING WSTRING · BYTE WORD DWORD LWORD |
| User-defined types | STRUCT, ENUM, ARRAY (1D and 2D), typed literals (WORD#16#FF, DINT#-100) |
| Variables & scope | VAR, VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT, VAR_TEMP, VAR_GLOBAL, PERSISTENT, RETAIN |
| Control flow | IF / ELSIF / ELSE, FOR, WHILE, REPEAT, CASE, RETURN, EXIT, CONTINUE |
| Operators | Arithmetic: + - * / MOD ** · Comparison: = <> < > <= >= · Logic: AND, OR, NOT, XOR · Bitwise (WORD/INT): AND, OR, XOR, NOT · Shift/Rotate: SHL, SHR, ROL, ROR |
| Comments | Block (* ... *), line // ..., doc comments (** ... *) for auto-generated documentation |
| Timers | TON, TOF, TP, TONR |
| Counters | CTU, CTD, CTUD |
| Bistables & edges | RS, SR, R_TRIG, F_TRIG |
| Standard functions | 30+ functions: String (LEN, CONCAT, REPLACE, LEFT, RIGHT, MID), Math (ABS, SQRT, SIN, COS, ROUND, FLOOR, CEIL, TRUNC), Type conversions (all scalar types), Time/Date (ADD_TIME, SUB_TOD, CONCAT_DATE_TOD, etc.), Array bounds (LOWER_BOUND, UPPER_BOUND) |
| Syntax highlighting | Full .st language support |
| Examples | 18 ready-to-run programs included |
Simulator
| Feature | |
|---|---|
| Interactive panel | Toggle BOOL inputs, edit numeric values, watch outputs react in real time |
| Scan cycle control | Configurable from 10 ms to 5000 ms |
| Trend charts | Oscilloscope view for every variable — 30 s of history, auto-scrolling |
Editor Intelligence (LSP)
| Feature | |
|---|---|
| Real-time diagnostics | Syntax and type errors underlined as you type — no need to run the simulator |
| Code completion | IntelliSense for variables, function blocks, standard functions and keywords |
| Hover documentation | Type information and signatures on hover |
| Go to Definition | F12 to jump to any variable or function block declaration |
| Find All References | See every usage of a symbol across your project |
| Rename Symbol | F2 to safely rename a symbol and all its references in one step |
| Cross-file support | All LSP features work across multiple .st files in the same workspace |
Pro — Debugging & Test
Tools to validate, debug and automate the verification of your ST logic.
| Feature | |
|---|---|
| Native Debugger (DAP) | Set breakpoints in .st files, step over statements (F10), step into function blocks (F11), inspect variables in the Variables panel and on hover — uses the VS Code Run & Debug panel natively |
| Watch Window | Live variable list with filter, sort, pinned variables and change history |
| Single Scan / Step | Pause the simulator and execute one scan cycle at a time |
| Snapshots | Capture and restore simulator state — ideal for reproducing bugs |
| Unit Testing | Write .plcsim.yaml test plans and run them from the VS Code Testing tab |
Pro — Project Structure
Organise large programs as modular, maintainable projects.
| Feature | |
|---|---|
| Custom Function Blocks | FUNCTION_BLOCK definitions, nested instances |
| Multi-File Projects | Split programs across types/, globals/ and blocks/ — loaded in dependency order |
Multi-File Project Layout
Create subdirectories in your workspace and PLCSim detects the structure automatically — no configuration needed:
workspace/
├── types/ ← TYPE … END_TYPE (structs, enums)
├── globals/ ← VAR_GLOBAL blocks
├── blocks/ ← FUNCTION_BLOCK definitions
└── Main.st ← main program logic (any name, any number of files)
Files are loaded in dependency order: types/ → globals/ → blocks/ → root .st files. Within each folder, alphabetical order.
Use PLCSim: New Project from the Command Palette to generate the structure automatically.
→ Full multi-file documentation
Pro — Export & Dialects
Take your validated logic to the real hardware.
| Feature | |
|---|---|
| TIA Portal export | Export programs as .scl files ready to import in Siemens TIA Portal |
| TwinCAT export (beta) | Export programs as native TwinCAT files (.TcPOU / .TcDUT / .TcGVL) — import in TwinCAT XAE with Add > Existing Item |
| Siemens SCL dialect | Native SCL syntax support |
| Beckhoff TwinCAT dialect | TwinCAT ST syntax support |
| Schneider Unity dialect | Unity Pro ST syntax support |
Pro — Industrial Communications
Connect the simulator to your real infrastructure.
| Feature | |
|---|---|
| OPC-UA server | Exposes all variables as OPC-UA nodes — connect any SCADA or HMI |
| Modbus TCP server | Map variables to coils and holding registers |
| EtherNet/IP server | Map variables to CIP tags |
| MQTT connector | Publish variables to Node-RED, Home Assistant or any MQTT broker |
Pro — Object-Oriented Programming (Edition 3)
Modern PLC code with classes, inheritance, and interfaces.
| Feature | |
|---|---|
| Classes | CLASS blocks with methods, properties, and internal state |
| Inheritance | EXTENDS for single-parent inheritance; SUPER to call parent methods |
| Interfaces | INTERFACE contracts; IMPLEMENTS for conformance |
| Properties | Computed attributes with GET and SET accessors |
| Methods | Callable procedures with parameters and return values |
| THIS | Reference to current instance inside methods and properties |
Pro — Documentation
Turn doc comments into shareable reference docs.
| Feature | |
|---|---|
| ST Documentation Generator | Generate Markdown documentation straight from (** ... *) doc comments — @description, @param, @returns, @author and @version tags for FUNCTION_BLOCK, FUNCTION and PROGRAM |
Free & Pro — AI Agents (MCP Server)
Give Claude Code, Claude Desktop, or any other MCP-compatible agent direct access to the PLCSim engine — validate, simulate, debug and export .st programs without VS Code open. The server ships bundled inside the extension — nothing to clone or build separately.
| Feature | Tier | |
|---|---|---|
plcsim_validate, plcsim_hover, plcsim_definition, plcsim_references, plcsim_rename, plcsim_simulate |
Free | Same diagnostics, LSP and simulator as the editor |
plcsim_debug_run, plcsim_run_tests, plcsim_export, plcsim_generate_docs |
Pro | Debugging, test plans, export, documentation |
Point your MCP client at ~/.plcsim/mcp-server/index.mjs — created automatically the first time you open VS Code with PLCSim installed, and stable across future updates.
Free — AI Assistant (@plcsim)
An AI chat participant that writes IEC 61131-3 Structured Text code from a plain-language description — and never shows you code it hasn't verified against PLCSim's own compiler.
| Feature | |
|---|---|
@plcsim chat participant |
Describe the logic you need in VS Code's Chat panel; get back a validated ST code block with a transparency footer ("validated on first try" / "after N retries") |
| Built-in safety rules | Fail-safe (NC) inputs, explicit IEC 60204-1 stop categories, bounded/deterministic loops, safe arithmetic — real industrial conventions, not generic coding advice |
| Validation loop | Every response is checked with the same LSP engine that powers editor diagnostics before you see it, with up to 3 automatic retries on error |
| Bring Your Own Key (BYOK) | Works with GitHub Copilot Chat by default, or connect your own Anthropic (pay-per-token) or Google Gemini (free tier available) API key via PLCSim: Configure AI Provider — keys are stored in the OS keychain, never on disk |
Early Adopter
Installed before October 1, 2027? You get full Pro access automatically — no license key needed, guaranteed forever.
Get Pro
Requirements
- VS Code 1.90 or later
- No additional software needed for Free features
- Mosquitto or any MQTT broker for MQTT connectivity (Pro)
- GitHub Copilot Chat, or your own Anthropic/Gemini API key, for the
@plcsimAI assistant
Extension Settings
| Setting | Default | Description |
|---|---|---|
plcsim.licenseKey |
— | Your Pro license key |
plcsim.aiProvider |
copilot |
AI model source for @plcsim: copilot, anthropic or gemini |
plcsim.aiModel |
— (auto) | Model ID for the active provider — leave empty for a sensible default |
License
See EULA