Chapter 8 of 12: show all chapters
Chapter 8 of 12Part 3: Writing the rules · 4 min
Rules in plain English
Before anyone writes code, they write the rules in ordinary words. You can do this already.
When this, do that
Most PLC rules have the same shape: when something is true, do something. “While the Start button is held, run the pump.”
Rules can have a “but not if”
“Run the pump while Start is held, but not if the tank is full.” The “but not if” part stops the tank overflowing.
Ask what could go wrong
Good engineers keep asking questions. What if the tank is already full? What if someone presses Stop? What if a sensor breaks? Each answer becomes another rule.
A rule that only works when everything goes right is not finished.
Try it
Pick a rule, then hold Start and watch the tank. Only one rule is safe.
- Start button
- Released
- Pump
- Stopped
New words
- Rule
- One instruction for the machine: when this happens, do that.
- Overflow
- When a tank gets so full that liquid spills out of the top.
Quick check
Which rule stops the tank from overflowing?