Simulate PLC programs in Structured Text (IEC 61131-3) directly in VS Code — no hardware needed.
Write and run complete Structured Text programs directly in VS Code.
No hardware, no compilation, no deployment. Free forever for learning and prototyping.
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
Logic & arithmetic
AND, OR, NOT, XOR, comparators, +−*/MOD**
Bitwise operators
AND, OR, XOR, NOT (on WORD/INT)
Shift & rotate
SHL, SHR, ROL, ROR
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, Time/Date, Array bounds
Syntax highlighting
Full .st language support
Examples
18 ready-to-run programs included
Simulator
Interactive panel
Toggle BOOL inputs, set INT/REAL values and watch outputs update instantly.
Scan cycle control
Configurable from 10 ms to 5000 ms with drift compensation
Trend charts
Oscilloscope view for every variable — 30 s of history, auto-scrolling
PLCSim — SimulatorRUNNING (SCAN: 142)
NAMETYPEVALUEDIR
bsensorentryBOOLIN
bsensorexitBOOLIN
itargetINT−100+IN
bmotorBOOLTRUEOUT
icounterINT47OUT
blotdoneBOOLFALSEOUT
Trends — ILEN Logic Over Time
Unit Testing FrameworkPRO
Write YAML test plans and run them from the VS Code Testing tab.
# .plcsim.yaml test plan file test_plan:"String Support Verification" steps:
- set: { sordercode:"ORD-ABC-042" }
- wait_cycles:10
- assert: { ilen:11, bready:true }
Pro — Debugging & TestPRO
Native Debugger (DAP)
Set breakpoints in .st files, step over (F10), step into function blocks (F11), inspect variables in the Variables panel and on hover
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 YAML test plans and run them from the VS Code Testing tab.
AI Assistant (@plcsim)FREE
A 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.
@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 Adopters
Installed before 2027-10-01? You get full Pro access automatically — no key needed.
Modern IEC 61131-3 Edition 3 with classes, inheritance and interfaces.
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 — DocumentationPRO
ST Documentation Generator
Generate Markdown documentation from (** ... *) doc comments — @description, @param, @returns, @author and @version tags for FUNCTION_BLOCK, FUNCTION and PROGRAM
AI Agents (MCP Server)FREEPRO
Connect Claude Code, Claude Desktop or any MCP client directly to the PLCSim simulation engine, without VS Code open.
Free tools
plcsim_validate, plcsim_hover, plcsim_definition, plcsim_references, plcsim_rename, plcsim_simulate — same diagnostics, LSP and simulator as the editor
Pro tools
plcsim_debug_run, plcsim_run_tests, plcsim_export, plcsim_generate_docs — debugging, tests, export and documentation
Server at ~/.plcsim/mcp-server/index.mjs — created automatically, stable across updates.