Lookahead: Difference between revisions

From Planimate Knowledge Base
Jump to navigation Jump to search
(Created page with '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 …')
 
No edit summary
 
Line 1: Line 1:
Lookahead is a unique feature of Planimate compared to regular programming languages.
Lookahead is a unique feature of Planimate® compared to regular programming languages.


When an [[item|item]] is waiting at a point of capacity (for example a [[Queue|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 [[Multiserver|server]] is busy with another item) then the server will check for blocked items behind it (unblock) when it becomes ready.
When an [[item|item]] is waiting at a point of capacity (for example a [[Queue|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 [[Multiserver|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 [[Switch|switches]] and [[Change|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.
Lookahead becomes interesting when [[Switch|switches]] and [[Change|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'''.
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|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.  
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|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.  
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 [[Object/Track|track network models]].
All this is managed automatically by Planimate®. Mechanisms exist to override and augment the lookahead process, particularly useful for [[Object/Track|track network models]].


Further information on lookahead and its impact on how switches work is described in [[About_Gating_Options|gating options]].
Further information on lookahead and its impact on how switches work is described in [[About_Gating_Options|gating options]].
<br>


[[Category:Object/Change]]
[[Category:Object/Change]]

Latest revision as of 16:42, 9 May 2011

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.