ironplcvm

Name

ironplcvm — IronPLC bytecode virtual machine

Synopsis

ironplcvm [OPTIONS] COMMAND

Description

ironplcvm is the IronPLC virtual machine runtime. It loads and executes compiled bytecode container (.iplc) files that ironplcc produces.

The runtime follows the IEC 61131-3 execution model. Each scheduling round, the runtime checks which tasks are due based on elapsed time and executes them in priority order.

By default, ironplcvm runs continuously until interrupted with Ctrl+C. Use --scans to limit execution to a fixed number of scheduling rounds.

Commands

ironplcvm run [OPTIONS] FILE

Load and execute a bytecode container (.iplc) file.

--dump-vars FILE

Write all variable values to the specified file after execution stops. The output contains one variable per line in the format NAME: VALUE, using the names recorded in the container’s debug section. A variable with no recorded name is reported as var[N]. Variables are dumped on both normal shutdown and after a runtime error.

Each value is written as the IEC 61131-3 literal for its declared type, the same rendering the debugger and the playground show:

msg: 'hello'
wide: "hello"
flag: TRUE
n: 42
ratio: 1.5
mask: 16#ABCD
span: T#1500ms
day: D#2024-01-15
clock: TOD#14:30:00
stamp: DT#2024-01-15-14:30:00
shade: GREEN (1)

Durations are written in milliseconds (T#1500ms, not T#1.5s) so the value is exact and reparses as the same literal. A value that cannot be read — a string whose container carries no layout for it, or one whose layout does not fit the program’s data — is written as <unavailable> or <invalid> rather than as a number that would read like a value.

Structures, arrays and function block instances are named by their type rather than shown, because the runtime does not yet record enough layout information to read their contents back:

origin: <POINT>
counts: <ARRAY OF DINT>
timer: <TON>
--scans N

Run exactly N scheduling rounds then stop. Without this option, the runtime runs continuously until interrupted with Ctrl+C.

ironplcvm version

Print the version number of the virtual machine.

Options

-v, --verbose

Turn on verbose logging. Repeat the flag to increase verbosity (e.g., -vvv).

-l FILE, --log-file FILE

Write log output to the specified file instead of the terminal.

Examples

  1. Run a compiled program:

    ironplcvm run main.iplc
    
  2. Run for a single scan and dump variable values:

    ironplcvm run main.iplc --scans 1 --dump-vars output.txt
    
  3. Run with verbose logging:

    ironplcvm -vv run main.iplc
    

See Also