From Planimate Knowledge Base
Jump to: navigation, search

Lookahead is a unique feature of Planimate® compared to regular programming languages.

When an item is waiting at a point of capacity (for example a Queue) it tests the next object that can hold it along its path to see if it can move there. If it can, it leaves the object it is at and moves through to the next object. If the item cannot move (for example a server is busy with another item) then the server will check for blocked items behind it (unblock) when it becomes ready.

Lookahead becomes interesting when switches and change objects are included in paths between objects with capacity. Since switches and change objects do not have any actual capacity, the item cannot come to rest at them. However it will look through them while it tries to find a place to go, then flow through them once an object that accepts the item has been found.

In Planimate®, the look through process is called lookahead, the flow through process is called item move.

For lookahead to be useful with change objects and switches, it needs to evaluate them and perform their actions whilst Planimate® is still exploring the possibilities of where the item might go. For example a routine at a change object might perform a calculation based on a situation in the model then use the outcome to control a switch to direct an item.

A further consequence of this is that changes made during lookahead need to be reversed, or undone.

All this is managed automatically by Planimate®. Mechanisms exist to override and augment the lookahead process, particularly useful for track network models.

Further information on lookahead and its impact on how switches work is described in gating options.