TwinCAT 3 library · live demo of the core logic

HRL/RBG control library

A pallet high-bay warehouse with one storage and retrieval machine. This page runs the core of the PLC library in your browser: axis profiles, the eight-step single cycle, rack booking, and telegram checks against an emulated material flow computer.

Source on GitHub
stored pallet pallet being retrieved job target Each place shows left | right side of the aisle. Column 0 is the transfer station.

RBG01

IDLE
  1. Travel + hoist to source
  2. Fork out
  3. Lift pallet
  4. Fork in
  5. Travel + hoist to target
  6. Fork out
  7. Lower pallet
  8. Fork in, job done

Counters

0stored
0retrieved
–last job [s]
0plant time [min]
0.00travel x [m]
0.50hoist y [m]

Telegrams MFR ⇄ PLC

What you are watching

New pallets arrive on the in-feed, pass the I-point and wait on the transfer station. The emulated material flow computer orders each one into the nearest free place. After every third store it orders the oldest pallet back out, so stores and retrievals alternate like in a real warehouse. Retrieved pallets leave over the out-feed.

The buttons on the left send the faulty telegrams from the interface test, or fail the travel drive mid-job. Watch the PLC answer in the telegram log.

How the PLC program is built

The plant is a tree of nodes. One Cyclic() call on the root runs every node, and each device returns eBusy, eDone or eError to the sequence that commands it.

FB_Hrl                    root mode node, built from HrlConfig.json
├─ FB_Srm  RBG01          single cycle, manual jog, homing, stop
│  └─ I_Axis ×3           FB_Axis (simulated profile) or FB_AxisNc (NC PTP)
├─ FB_ConveyorZone  Infeed    one standard block,
└─ FB_ConveyorZone  Outfeed   different parameters
FB_Rack             which place holds which pallet, size from the config
FB_MfrInterface     checks every telegram before anything moves
FB_MfrLinkTcp       TCP server to the real MFR, fixed-length telegram codec
FB_TeachIn          guided teach-in with tolerance check
FB_Diag             fault list: cause and remedy
FB_SafetyInterface  drive enable and restart lock from the safety controller
FB_HmiBridge        TwinCAT HMI operator page

This page runs the crane with simulated axes, the conveyors, the rack and the telegram checks. Configuration, NC axes, the TCP link, teach-in, the safety interface and the HMI are in the TwinCAT project.

One RBG job, step by step

  1. Travel and hoist drive to the source together. The move takes as long as the slower axis.
  2. The telescopic fork extends 1.10 m into the place (left side negative, right side positive).
  3. The hoist lifts 0.10 m. The pallet is booked off the source place at this moment.
  4. The fork retracts with the pallet.
  5. Travel and hoist drive to the target, still lifted.
  6. The fork extends into the target place.
  7. The hoist lowers. The pallet is booked into the target place at this moment.
  8. The fork retracts. The PLC reports TDON to the material flow computer.

Every telegram is checked first

A transport order only starts the RBG if every check passes. Otherwise the PLC answers TERR with a status code and nothing moves.

CheckStatus
Sequence number is the expected next one40
Order number is not active or just finished41
Source and target exist42
RBG is free and not faulted43
Source place holds a pallet11
Target place is free10
The pallet at the source is the ordered one44
TDON acknowledged within 5 s30

The throughput proof

FEM 9.851 measures an RBG by its double cycle: store at P1 (1/5 of the rack length, 2/3 of its height), travel empty to P2 (2/3 length, 1/5 height), retrieve there, return to the station. With travel 3.0 m/s, hoist 1.5 m/s and a 1.10 m fork, the calculation gives 52.4 s, about 69 double cycles per hour. A unit test runs the same two jobs on the simulated RBG and requires the measured time to stay within 5 % of that figure.

What this page is, and is not

This page is a JavaScript port of the core PLC logic for viewing; everything on it is simulated. The TwinCAT project in the repository is the actual program: configurable from a JSON file, on simulated or NC axes, with a TCP link to the material flow computer, teach-in, diagnostics, a safety interface and a TwinCAT HMI page, covered by 59 TcUnit tests that run on the soft-PLC. It has not run on real hardware; the safety function itself belongs in a safety controller.