A custom type earns its keep when it maps to a real job: STRUCT for recipes, ENUM for modes. The sharpest of them is the UNION, which lets you read the same bytes two ways. Flip some bits and watch every view update at once.
A drive packs a status word into 16 bits. Type the value or click individual bits. The WORD, the two bytes and the 16 BOOLs are the same memory, so they always agree.
asBits: ARRAY[0..15] OF BOOL (click a bit to toggle it)
TYPE Temperature : REAL; END_TYPE // ALIAS: clearer intent TYPE Channel : UINT(1..8); END_TYPE // subrange: range-safe stations : ARRAY[1..8] OF ST_Station; // a tabulated line
🏷️ ALIAS renames a type so Temperature reads better than a bare REAL. The storage is the same; only the code gets clearer. ALIAS and subrange are IEC 61131-3 derived types, but Sysmac Studio's own derived types are only structures, unions and enumerations.
📏 Subrange bakes limits into the type: a Channel can only be 1–8, so an out-of-range value is caught at the source. On an NJ/NX you set the same limit as a range specification on the variable itself.
Why reach for a UNION when decoding a fieldbus register?