Attention
IronPLC implements many parts of the IEC 61131-3 standard and is working toward full Structured Text support. Key features still missing include arrays and structures. Try it out in the IronPLC Playground.
Enabling Features¶
IronPLC aims to let you take code from another PLC environment and use it without changes. However, the IEC 61131-3 standard has evolved through multiple editions, and some features require you to tell IronPLC which edition your code targets.
Editions of the Standard¶
The IEC 61131-3 standard has been published in several editions:
- Edition 2 (2003)
The widely deployed baseline. IronPLC uses this edition by default.
- Edition 3 (2013)
Adds new data types (LTIME, LDATE, LTIME_OF_DAY, LDATE_AND_TIME) and other language enhancements.
Editions are additive — enabling a later edition includes all features from earlier editions.
See Edition Support for a complete list of features that require a specific edition.
How to Enable an Edition¶
Command Line¶
Pass the --std-iec-61131-3 flag when running ironplcc:
ironplcc check --std-iec-61131-3=2013 main.st
See ironplcc for all compiler options.
Visual Studio Code¶
Set the ironplc.std61131Version setting to 2013:
Open (or on macOS).
Search for
ironplc.Change Std 61131 Version to
2013.
Or add it directly to your settings.json:
{
"ironplc.std61131Version": "2013"
}
See Settings Reference for all extension settings.
Vendor Extensions¶
Some PLC vendors support features beyond the IEC 61131-3 standard. IronPLC provides flags for these common vendor extensions to improve compatibility with code written for other PLC environments.
--allow-allEnable all vendor extensions at once.
--allow-top-level-var-globalAllow
VAR_GLOBALdeclarations at the top level of a file, outside of aCONFIGURATIONblock. See Variable Scope.--allow-constant-type-paramsAllow constant references in type parameters such as array bounds and string lengths (e.g.,
ARRAY[1..MY_CONST] OF INTorSTRING[MY_CONST]). See Array Types.
Pass the flag when running ironplcc:
ironplcc check --allow-all main.st
Or enable individual extensions:
ironplcc check --allow-top-level-var-global --allow-constant-type-params main.st
See ironplcc for all compiler options.