TwinCAT Engineering Notes
TwinCAT is a software suite by Beckhoff that transforms a PC into a real-time controller. An industrial automation standard adopted by Tesla, SpaceX, BMW, and ASML.
Here you will find deep dives into the architecture, edge cases, and undocumented behavior of such systems.
What is TwinCAT in detail▸ Recent writing
All posts →Ignoring Method Parameters Using Special Values
Elegant approaches to ignore parameters or retain previous values in TwinCAT / CoDeSys using REFERENCE TO and quiet NaN (Not a Number).
REFERENCE TO properties in TwinCAT 3 / CoDeSys
Key nuances of working with REFERENCE TO properties: `REF=` vs `:=` operators, getters, setters, and online monitoring of complex types.
Methods with optional arguments
Uses of method arguments with default values, their features and limitations in TwinCAT/CoDeSys.
Working with Variable-Length Collections in Structured Text Using IEnumerator
How to bypass the limitations of fixed-size arrays in TwinCAT and CoDeSys. Implementing the IEnumerator interface for flexible dynamic sequence iteration.
Nuances of Working with Function Block Instances by Value in TwinCAT 3 / CoDeSys
A detailed analysis of memory copying (MEMCPY) and object lifecycle (FB_Init/FB_Exit) when working with function block instances by value in IEC 61131-3.
Extending FB_Init Parameters in TwinCAT: Constructors for Derived Classes
How to extend the parameter list of the FB_Init method in derived classes for Predictable Initialization in TwinCAT and CoDeSys. Benefits and compiler limitations.