Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>PLCSimNew to Visual Studio Code? Get it now.
PLCSim

PLCSim

appscat

|
3,387 installs
| (0) | Free
Simulate PLC programs in Structured Text (IEC 61131-3) directly in VS Code — no hardware needed
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PLCSim

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

→ User Manual


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 (with optional default member), ARRAY (1D and 2D, including arrays of function block instances), typed literals (WORD#16#FF, DINT#-100)
References REFERENCE TO / REF_TO (IEC 61131-3 Edition 3 standard) — REF(), dereference ^, NULL, with clear runtime errors on NULL access
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 20 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
Cold / Warm restart Explicit restart buttons in the Simulator panel — Cold clears RETAIN state, Warm preserves it, matching real PLC restart semantics

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 — set / assert / assert_range / wait_until on variables, assert_modbus to check protocol registers, and plans can target a Ladder .ld.json directly

Pro — Ladder Diagram Editor

A visual editor for Ladder Diagram (LD) — the industry-standard graphical language for PLC logic — that compiles directly to the same Structured Text engine as the rest of PLCSim.

Feature
Visual canvas Draw contacts, coils and parallel groups on an SVG canvas — undo/redo, live structural validation, auto-generated variable declarations
Unified tool + form pattern One toolbar per element family (Contact / Coil / Group / Block) — click a tool, click a placement point, fill in a small inline form. No hunting through a wall of buttons
Timer & counter blocks TON, TOF, CTU, CTD, CTUD as first-class Ladder elements — placed, configured and wired from the canvas, with automatic multi-instance aggregation so a stateful block is called exactly once per scan cycle even when driven from several rungs
Coil fork Multiple coils per branch, each driven by the accumulated logic since the start of the branch — the same wire-fork pattern used in TIA Portal, Studio 5000 and CODESYS to feed several outputs from shared input logic
Documentation generator Turn a Ladder Diagram into readable Markdown documentation, same tooling as the ST doc generator

→ Also exposed to AI agents via the MCP server: plcsim_validate_ladder, plcsim_compile_ladder, plcsim_simulate_ladder (Free), plcsim_generate_ladder_docs (Pro)


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, discrete inputs, holding and input registers — and verify the mapping from a .plcsim.yaml test plan (assert_modbus), no external client needed
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, interfaces and polymorphic dispatch.

Feature
Classes CLASS blocks with methods, properties, and internal state
Inheritance EXTENDS for single-parent inheritance; SUPER to call parent methods
Interfaces & polymorphism INTERFACE contracts with IMPLEMENTS; use an interface name as the type of a variable, parameter or array element — method calls dispatch to the actual type of the assigned instance
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
Instance collections ARRAY[..] OF <FB> and nested sub-instances (outer.inner.Method()) for the "N identical devices in a loop" pattern

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_validate_ladder, plcsim_compile_ladder, plcsim_simulate_ladder Free Validate, compile and simulate a Ladder Diagram (JSON) without opening the visual editor
plcsim_debug_run, plcsim_run_tests, plcsim_export, plcsim_generate_docs, plcsim_generate_ladder_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.

→ MCP Server setup guide


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 ("compiled cleanly 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, and the 22 PLCopen Safety function blocks named explicitly where they apply — 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
Self-test For requests with a checkable input/output behavior, the assistant also writes a small test plan of its own and runs it against the generated code in PLCSim's simulator — if the code doesn't behave the way the assistant itself expected, that feeds back into the same retry loop. A consistency check, not a correctness guarantee
Safety warnings Static checks on the generated code, shown as non-blocking warnings: REAL equality (including the disguised x >= K AND x <= K), a decision without a default branch, over-deep nesting, and a naming heuristic for emergency-stop inputs used without NOT
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

→ AI Assistant setup guide


Early Adopter

Installed before October 1, 2027? You get full Pro access automatically — no license key needed, guaranteed forever.


Get Pro

→ plcsim.appscat.cat


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 @plcsim AI 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

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft