CODE.01 / F · FB · OOP
How to build a PLC program that survives its own change orders.
From “why does copy-paste hurt?” to interfaces, inheritance and polymorphism. Every construct is shown in both ladder and Structured Text, every example runs live on the in-browser engine so you can watch it scan by scan, and the whole track ends in a workshop of real plant tasks — pump gangs, batch sequencers, recipe files and production logs.
▸ READING AS A GUEST
All 15 lessons are open — read them without an account. Signing up saves your place, keeps your XP and streak, and opens the whole workshop instead of the first few exercises.
CH.01 · THE TWO BUILDING BLOCKS
Why copy-paste rots, what a POU actually is, and the two constructs every PLC brand on earth agrees on: FUNCTION and FUNCTION_BLOCK.
LESSON.01
How unstructured PLC code fails on a real plant, what a POU actually is, and why a change needs one home.
LESSON.02
The stateless calculator — same inputs, same answer, every scan, called from anywhere.
LESSON.03
The machine with a memory — one block type, as many instances as the plant has motors.
LESSON.04
The contract — who may write, who may read, and what survives the scan.
LESSON.05
TON, CTU and R_TRIG are function blocks — read them as proof of the instance model.
CH.02 · IEC 61131-3 3RD EDITION
Encapsulation, methods, properties, interfaces, inheritance and polymorphism — the object extensions, and exactly what each one buys you on a machine.
LESSON.06
The sealed panel — a block you can trust because nobody can reach inside it.
LESSON.07
Behaviour that belongs to the data — called on demand, not every scan.
LESSON.08
A member that looks like a variable and runs code — getters, setters, and the scan time they can cost.
LESSON.09
the plug, not the device — write code against a shape and swap the hardware underneath.
LESSON.10
Inheritance — a base machine plus the factory options, and the depth that kills you.
LESSON.11
one loop, twelve machines — how the controller picks the right code at runtime.
CH.03 · WHAT TO ACTUALLY BUILD
Composition against inheritance, what each vendor really supports, and the handful of patterns that earn their keep on a plant floor.
LESSON.12
HAS-A beats IS-A on a plant floor — build skids from parts you can replace.
LESSON.13
What CODESYS, TwinCAT, Siemens, Rockwell and the rest actually support — and how to write code that ports.
LESSON.14
The handful of structures real machines are built from — and when to use none of them.
CH.04 · ARCHITECT IT YOURSELF
Take a real line from I/O list to block architecture, then prove it in the workshop.
▸ HANDS-ON · THE OOP WORKSHOP
Scaling a transmitter, a motor block used twice, a three-pump duty gang, an array of conveyor zones, a batch state machine, a device manager — and the jobs every commissioning engineer eventually meets: writing a production log to the controller's memory card and reading a recipe back out of a text file. You write the ST, the engine grades it.
▸ open the workshop▸ FEEL THE PROBLEM · PATCH DAY
Before (or after) the lessons: take a maintenance shift on a plant written with zero function blocks. A change order lands, you hunt every pasted copy it touches, and the engine shows you exactly what the one you missed costs. Then the same shift, one FUNCTION_BLOCK, one edit.
Work through the chapters in order — each one assumes the last.
0 / 15 complete