Run TwinCAT 3 Projects Without a PLC¶
This guide shows how to compile a Beckhoff TwinCAT 3 project and execute its logic in the IronPLC virtual machine — on any computer, with no TwinCAT runtime, no license, and no PLC hardware. This is useful for testing control logic on a laptop or in a CI/CD pipeline.
Note
This guide assumes you have installed the IronPLC Compiler. See Installation if you have not already installed it.
Compile the Solution¶
Compile your solution into a bytecode container: point
ironplcc at the solution directory and select the twincat
dialect:
ironplcc compile --dialect twincat path/to/my-solution --output main.iplc
IronPLC discovers the sources through the .plcproj project files,
activates any referenced Beckhoff libraries (see
Use Beckhoff Libraries), and on success creates main.iplc —
the compiled bytecode that the IronPLC virtual machine executes.
Run the Compiled Program¶
Run the container in the IronPLC virtual machine:
ironplcvm run main.iplc --scans 1 --dump-vars
The --scans 1 flag runs one scan cycle, and --dump-vars prints the
value of every variable after execution. For a program that converts a
commanded speed from degrees to radians, the output looks like:
commandedDegPerSec: 15
commandedRadPerSec: 0.2617993877991494
Your MAIN program runs exactly as it would in each PLC cycle. To
observe state that evolves over time — timers, counters, edge triggers —
increase --scans.
Run in a CI/CD Pipeline¶
Both tools return a non-zero exit code on failure, so the same commands work as a pipeline gate:
ironplcc check --dialect twincat . || exit 1
ironplcc compile --dialect twincat . --output main.iplc || exit 1
ironplcvm run main.iplc --scans 10 || exit 1
This catches problems on every commit — before the code ever reaches a test rig.
See Also¶
Check, Compile, and Run from the Command Line — the same workflow explained for plain IEC 61131-3 files
ironplcc — full ironplcc command reference
ironplcvm — full ironplcvm command reference
IronPLC Execution Cycle — how scan cycles work