Skip to content

OpenPLC

If your target is Siemens, Mitsubishi, or CODESYS/TwinCAT, use the matching vendor page instead.

Compatibility Guide

OpenPLC Interop v1 (ST-focused)

This guide defines the current OpenPLC interoperability baseline for trust-runtime plcopen.

Scope

  • Input format: PLCopen XML (http://www.plcopen.org/xml/tc6_0200).
  • Interop profile: trust-st-complete-v1.
  • Product scope for this phase:
  • ST-focused import/export.
  • OpenPLC ecosystem detection (detected_ecosystem = "openplc").
  • Vendor-library alias normalization aligned with the existing CODESYS/Schneider baseline.

Explicit Non-Goals

  • No semantic import of graphical network models (FBD/LD/SFC).
  • No claim of full OpenPLC runtime semantic equivalence.
  • No hardware deployment conversion guarantees.

Command Surface

trust-runtime plcopen import --input <openplc.xml> --project <target-dir>
trust-runtime plcopen import --input <openplc.xml> --project <target-dir> --json
trust-runtime plcopen export --project <project-dir> --output <plcopen.xml>
trust-runtime plcopen export --project <project-dir> --output <plcopen.xml> --json

Expected Import Signals

When importing OpenPLC-origin XML (for example generated by OpenPLC Editor), the migration report should include:

  • detected_ecosystem: "openplc"
  • applied_library_shims[] entries for normalized aliases (for example R_EDGE -> R_TRIG)
  • unsupported_diagnostics[] entries for out-of-scope model elements
  • deterministic coverage summary fields (source_coverage_percent, semantic_loss_percent, compatibility verdict)

The report is written to:

  • <project>/interop/plcopen-migration-report.json

End-to-End Sample Bundle

OpenPLC fixture coverage is now integrated into the ST-complete PLCopen tutorial bundle:

  • examples/plcopen_xml_st_complete/
  • Legacy path examples/openplc_interop_v1/ was retired after consolidation.

Use:

  • examples/plcopen_xml_st_complete/interop/openplc.xml
  • walkthrough in examples/plcopen_xml_st_complete/README.md

Diagnostics You Should Expect

Common deterministic diagnostics in OpenPLC migrations:

  • PLCO301: shim normalization was applied.
  • PLCO203: unsupported pouType (for example graphical/non-ST entries).

Treat these diagnostics as migration evidence, not failures of the toolchain.

Validation Coverage

OpenPLC regression coverage is enforced in runtime tests:

  • crates/trust-runtime/tests/plcopen_migration.rs
  • crates/trust-runtime/tests/plcopen_command.rs

The test fixture is:

  • crates/trust-runtime/tests/fixtures/plcopen/openplc.xml
  • docs/guides/PLCOPEN_INTEROP_COMPATIBILITY.md
  • docs/guides/VENDOR_LIBRARY_COMPATIBILITY.md
  • docs/guides/PLCOPEN_EXPORT_ADAPTERS_V1.md