💡 Select a scenario
Choose a scenario from the sidebar to load a ladder program.
📖 Reading the Ladder
Power flows from the left rail (L1) to the right rail (L2). Green segments are energized, gray are de-energized. Contact tags and live values are shown above and below each element. Rungs execute top-to-bottom, left-to-right, once per scan.
🖐 Interactive Process Panel
Press and hold pushbuttons (momentary), click toggle switches, and watch outputs respond. Start the scan in the sidebar — or use Step — to let the ladder logic drive the process.
Why This Matters
Ladder logic is the lingua franca of industrial control. It survives because electricians and technicians can read it like the relay circuits it replaced — and because the PLC scan model that governs it is brutally deterministic. A PLC does not react to events; it samples inputs, sweeps the program top-to-bottom, then writes outputs. Every behavior you see in this simulator — seal-ins holding, interlocks blocking, cascades propagating one scan per stage — falls out of that model.
The PLC Scan Cycle
- 1. Input scan — all physical inputs are read into the input image table. The program sees this snapshot, not the live terminals.
- 2. Program execution — rungs execute top-to-bottom, left-to-right, using the input image and the latest coil values written so far this scan.
- 3. Output update — the output image table is written to the physical outputs. Then the cycle repeats, typically every 1–50 ms.
Order matters: a rung that reads a bit written above it sees the new value in the same scan; a rung that reads a bit written below it waits one full scan. Load the Scan Cycle Demo scenario and use Step to watch a three-stage cascade take three scans to propagate.
Instruction Reference
—| |— Normally Open (NO) Contact
Examines a bit. Passes power to the right when the referenced tag is TRUE (1). Think of it as a switch that's open by default — it must be energized to close. (XIC — Examine If Closed.)
—|/|— Normally Closed (NC) Contact
Examines a bit. Passes power to the right when the referenced tag is FALSE (0). Default state is closed — it opens when energized. Used for Stop buttons and interlocking contacts. (XIO — Examine If Open.)
—( )— Output Coil
Sets a bit. Turns the referenced output ON (1) while the rung has continuity, OFF (0) when it doesn't. Coils are the “actions” of the program.
[TON] Timer On-Delay
Starts timing when the rung becomes true. DN (Done) bit sets after the preset time. A non-retentive TON resets — ACC to zero, DN cleared — whenever the rung goes false, even after DN has set. Use a seal-in rung if the done state must persist (see Timed Motor Run).
[TOF] Timer Off-Delay
DN stays ON while the rung is true. When the rung becomes false, DN stays ON for the preset time, then drops OFF. Re-energizing the rung during the delay restarts it. Classic use: cooling-fan run-on.
[CTU] Counter Up
Increments ACC each time the rung transitions from false to true (rising edge). DN sets when ACC ≥ preset. Counting the rung edge — not the scan — is what makes counters usable.
[RES] Reset
Zeros a timer's ACC or a counter's ACC when the rung is true. Clears DN and all associated done-tag bits immediately.
Tag Naming Conventions
Inputs often prefix with I: or PB_/SW_ (pushbutton/switch). Outputs with O: or M_/PL_/SOL_/KM (motor/pilot light/solenoid/contactor). Clear names make programs readable.
Classic Circuits
- Seal-in (latching): an output contact wired in parallel with a momentary Start button maintains the output after the button is released. The Stop contact sits in series to break the seal. This is distinct from OTL/OTU latch instructions, which this simulator does not implement.
- Interlocking (program): NC contacts of one output in another rung so the program never commands conflicting outputs at once — e.g. the Forward coil's NC contact in the Reverse rung. This is program interlocking only: real reversing and star-delta starters also require hardwired auxiliary-contact and mechanical interlocks, because program logic cannot protect against a welded contactor contact or an output-module fault.
- Star-Delta starting: a reduced-voltage starter for 3-phase motors. It starts in Star (Y) — phase voltage reduced by 1/√3, line current and torque to about one-third — then a timer transitions to Delta (△) for full-voltage running. Real starters add a short changeover dead-time between star drop-out and delta pull-in, hardwired and mechanical contactor interlocks, and an overload relay — this simulator shows the logic sequence only.
Fail-Safe Stop Wiring
On real machines the Stop pushbutton is a physically normally-closed contact, and the program examines it with a Normally Open (XIC) instruction — the input reads 1 while running is permitted, so a broken wire or lost signal stops the machine. This fail-safe practice comes from IEC 60204-1 and NFPA 79 (safety of machinery — electrical equipment of machines).
For simplicity this simulator models Stop buttons as physically-open contacts (the input reads 1 only while pressed) examined with NC instructions. Invert this convention on real equipment.
IEC 60204-1 and NFPA 79 also define three stop categories, and the choice drives how the stop circuit is built:
- Category 0 — uncontrolled stop by immediate removal of power to the machine actuators.
- Category 1 — controlled stop with power kept available to the actuators to achieve the stop, then removed once standstill is reached.
- Category 2 — controlled stop with power left available to the actuators.
Emergency stop must be Category 0 or 1, and it is a complementary protective measure — it never replaces guarding or the safeguards designed into the machine.
Common Mistakes
- Forgetting that a rung reading a bit written below it acts one scan late — cascades and one-shots misbehave when rung order is wrong
- Using a seal-in with a physically-open stop input on real equipment — a broken stop wire then makes the machine unstoppable (see Fail-Safe Stop Wiring)
- Relying on program interlocks alone for reversing starters — a welded contactor contact defeats any logic
- Expecting a non-retentive TON to remember its done state after the rung drops — it doesn't; seal the done bit into a separate rung
- Counting with a sensor contact alone — gate it with the machine-running contact so jogging the sensor while stopped doesn't count parts
🎯 Test Your Knowledge
Answer questions about ladder logic, the PLC scan cycle, and the classic circuits in this simulator. Each answer comes with an explanation.