Machinery TwinDocs

Pattern cookbook

Well-worn state machine structures, cycles, homing, interlocks, ping-pong.

The step sequence (move → done → move)

The most common machine pattern, each state runs one Position move, and a positionDone transition advances:

Home ──done──► ToPick ──done──► Gripping(timer) ──► ToPlace ──done──► Release(timer) ──► ToPick …

Grip/release states pair a SetValue (Gripper = 1/0) with a short timer so the action is visible.

The infinite demo cycle

For an unattended showcase loop: a chain of states ending with a transition back to the first. Timers pace the phases; presentation mode (F11) hides the UI. No operator, no PLC, runs all day at a trade-show booth.

Homing

An initial Homing state runs Position moves to the home pose, then transitions (positionDone) into Ready. Because the initial state re-runs on every simulation start, the twin always starts from a defined pose, just like the real machine's homing sequence.

Interlock / handshake

Two machines coordinate through shared variables:

  • Machine A, state WaitStationFree: transition on StationBusy == 0; its working state sets StationBusy = 1 (SetValue) and releases it in the exit state.
  • Machine B mirrors it.

The same pattern handshakes with a PLC in Online mode: wait on a PLC-fed flag, let the PLC wait on yours.

Ping-pong (shuttle)

Two Position moves with opposite targets and positionDone transitions between them, a shuttle, an oscillating diverter. Add end-dwell timers for realism.

Fault state

Give long sequences an Alarm state reachable from anywhere critical (alarm condition first in each state's transition list), setting colors via a TwoValuesColor-driven status lamp. A Reset variable transition leads back to Homing.

On this page