TwinCAT¶
IronPLC supports Beckhoff TwinCAT 3 project files for checking IEC 61131-3 programs developed in the TwinCAT XAE environment.
File Extensions¶
IronPLC recognizes the following TwinCAT file extensions (case-insensitive):
.TcPOU- Program Organization Units (programs, function blocks, functions).TcGVL- Global Variable Lists.TcDUT- Data Unit Types (type declarations).TcIO- Interface declarations (requires--allow-fb-inheritance, which thetwincatdialect enables automatically; see Enabling Dialects and Features)
Supported Languages¶
Fully Supported:
Structured Text (ST) - Text-based programming language
Sequential Function Chart (SFC) - State-machine based programming with ST action bodies
Not Supported:
Function Block Diagram (FBD) - Graphical language
Ladder Diagram (LD) - Graphical language
Instruction List (IL) - Deprecated text-based language
Supported Elements¶
Data Types:
Elementary types (BOOL, INT, REAL, STRING, etc.)
Enumeration types
Array types (single and multi-dimensional)
Structure types
Subrange types
Type aliases (derived types)
Program Organization Units:
Functions
Function Blocks
Programs
Configuration:
Configurations
Resources
Tasks
Program instances
SFC Elements:
Steps (including initial step)
Transitions with ST conditions
Actions with ST bodies
Action associations with qualifiers (N, R, S, L, D, P)
Project Discovery¶
When you point IronPLC at a directory, the compiler searches it
recursively for .plcproj files — the marker of a TwinCAT 3 PLC
project. This means you can point IronPLC at any level of the Visual
Studio solution layout that TwinCAT XAE creates:
MySolution/
├── MySolution.sln
└── MySolution/
├── MySolution.tsproj
└── PlcProject/
├── PlcProject.plcproj
└── POUs/
├── MAIN.TcPOU
└── F_Helper.TcPOU
The .sln and .tsproj files are not themselves parsed;
discovery walks past them to each .plcproj, which it reads to
determine the source files to analyze (the <Compile> items).
When discovery finds more than one .plcproj, all discovered
projects are merged into a single compilation unit, so code in one
project can use declarations from another. A project entry that cannot
be resolved does not abort discovery of the remaining sources.
Library References¶
Discovery also reads each .plcproj project’s library references
(<PlaceholderReference> and <LibraryReference> items). A
reference whose name matches a bundled
compatibility library
activates that library automatically; a reference to a library IronPLC
does not bundle reports problem
P6011. Names are matched
exactly and case-sensitively; the declared version is not used to select
a package. Precompiled library files (.library /
.compiled-library) are not read.