Skip to content

Logic and PLC in DES

Commercial

Included in the public demo Compare editions

In a DES run, your control logic is driven by simulation events instead of the render frame. A delay ends at exactly its time, a wait reacts at the moment its signal changes, and a PLC program scans when something it reads has changed. The result is the same in Animated, Hybrid, Fast Forward and Step, so you can develop a control sequence live and then run it through experiments.

Part of the modelHow it runs in DES
LogicStepsOn events. A Delay ends exactly at its time; waits for signals, sensors, zones and drives wake on the change.
Virtual PLC (ST programs)On events. A program scans when a signal it reads changes, when one of its timers (TON, TOF, TP) runs out, or right after its own change. See Writing ST for DES.
Grippers and zonesPart of the snapshot. Gripper steps wake the logic when a part is picked or placed. Grippers and classic sources do not run on events yet.
Pre-placed parts (MUs)Part of the model state; a part held by a gripper or zone currently prevents a snapshot (see below).

LogicSteps need no changes. Sequences that cannot run on events are listed in the Problems panel with the step:

  • an auto-loop sequence without any waiting step
  • a backward or self jump without a waiting step
  • a JavaScriptStep, or WaitForSensor with Wait for stopped, which have no event mapping yet

A sequence that jumps or loops without any waiting step is stopped after 10,000 instant steps and reported as logic-instant-loop; the viewer no longer freezes. Short delays in an auto-loop (below 0.1 s) are only a hint: they cost many events per simulated second.

A pick, place or source-generate signal that pulses within one DES time step is listed as des-zero-time-pulse: a consumer that only checks the level at its movement tick can miss it. Hold such a command until the feedback arrives.

Write the program so that another scan with unchanged inputs changes nothing. The editor checks this while you type:

  • Findings start with DES: and are shown as information, separate from compile errors.
  • A program with a blocking finding (rules D1 and D2) gets the badge not DES-ready. D3 and D4 are hints.
  • On DES start, Problems lists PLC program cannot run on events (des-plc-not-event-suitable) with program and line. The interactive run still starts; experiment batches refuse the model.
  • If you have checked that a flagged statement settles, (* @des: allow *) on its line suppresses D1 or D2 for that statement.
  • A program that never comes to rest (for example two programs flipping each other’s outputs) is stopped after 64 rounds at one simulated time. It enters error and Problems reports des-settle-overflow.

The rules with good and bad examples, the exact messages and the differences from cyclic scanning are in Writing ST for DES.

Models with LogicSteps and ST programs can run experiment batches. The standard demo model is batch-capable. A batch is refused only for what cannot run unattended:

  • LogicStep sequences with the findings above
  • ST programs that are not DES-ready
  • IK paths and replay

The refusal names the system and node. Blockages in such runs show up in the matrix as Blocked runs.

A snapshot saves LogicSteps (which step is active, running delays and waits), grippers and zones together with the rest of the run; see Saving and Restoring a Run. A snapshot is refused, visibly and with the address of the cause, when it would contain something that cannot be restored exactly:

Blocker shownMeaning
Grip / Zone <address> holds N MUA gripper or zone holds a part. Wait until it has released it.
LogicStep JavaScriptStepA JavaScriptStep is currently running.
LogicStep WaitForSensor (WaitForStopped)A step is currently waiting for a part to stop.
PLC programs runningA running ST program. PLC programs are not part of the snapshot yet; stop them to save.

Checkpoints in experiments follow the same rules.