TransporterControl

Defines the rules of navigation in the network and the routing algorithm for transporters with path-guided type of navigation.

If you are using the default navigation rules (the Navigation option is set to Automatic), transporters can resolve possible collisions in the network nodes automatically (this is specified by Resolve collisions option). The transporters will arrive at the node and stop. After waiting out a period of time, specified in the Collision detection timeout parameter, they will move along their respective routes over each other.

With the help of the Avoid collisions option you can optimize the transporters' route: if more than one transporter has to take a path or move through a node, the route will be made available to only one of them, while the others will yield to avoid collision.

For custom navigation you can specify your own conditions that must be satisfied for transporters to enter any node or path.

In this block you can specify a custom routing algorithm as well as individual paths and nodes that must be excluded from the route.

Demo model: TransporterControl Overtaking

Parameters

Navigation
Defines the rules of transporters movement in the network. If the option is set to Automatic, the AnyLogic engine will resolve transporter collisions. If the option is set to Custom, you can specify your own conditions for the transporter movement along the paths and in the nodes of the network.
Syntax: boolean automaticNavigation
Set new value at runtime: set_automaticNavigation(new value)
Valid values: truefalse
Resolve collisions
[Visible and applies only if the Navigation option is set to Automatic] If the option is selected, all the transporter collisions will be automatically resolved by the AnyLogic engine. The model will wait for the default collision timeout, and in case the collision remains unresolved, transporters will continue their movement by driving one over another inside the corresponding point node. If the option is disabled, the model will stop once transporter collision occurs, and an error message will be displayed.
Syntax: boolean resolveCollisions
Set new value at runtime: set_resolveCollisions(new value)
Avoid collisions
[Visible and applies only if the Navigation option is set to Automatic] If the option is selected, the AnyLogic engine will optimize movement of transporters to maximally avoid transporter collisions. However, this does not guarantee complete collision avoidance. The algorithm will analyze transporter routes. If there is a path required by several transporters, this path will be enabled only for a certain transporter, while the other transporters will have to wait wait for the path to become available again.
Syntax: boolean avoidCollisions
Set new value at runtime: set_avoidCollisions(new value)
Collision detection timeout [dynamic]
[Visible and applies only if the Navigation option is set to Automatic] A period of time the transporters must spend waiting at the crossroads if there is a collision to be resolved.
Type of value: double
Local variable: Agent unit - the agent
Can enter node [dynamic]
[Visible and applies only if the Navigation option is set to Custom] Here you specify an expression which will be evaluated when the transporter intends to enter a node. If the expression returns true, the transporter can enter this node.
Type of value: boolean
Local variables: T unit - the transporter
                            Agent agent - the agent
                            Node node - the node
Can enter path [dynamic]
[Visible and applies only if the Navigation option is set to Custom] Here you specify an expression which will be evaluated when the transporter intends to enter a path. If the expression returns true, the transporter can enter this path.
Type of value: boolean
Local variables: T unit - the transporter
                            Agent agent - the agent
                            Path path - the path
Find path [dynamic]
By default the shortest option is selected. In this case the AnyLogic engine will always use shortest paths for transporter movement.
If you need some other routing algorithm, you can define this algorithm as a function returning the route (RouteData object). Having done so, switch this field to dynamic value editor and place this function call there.
Type of value: RouteData
Local variables: T unit - the transporter
                            Agent agent - the agent
                            ILocation source - the source
                            ILocation target - the target
Avoid paths [dynamic]
A path (or several paths) that you want to exclude from the automatically calculated route for transporters.
Type of value: Path[]
Local variables: T unit - the transporter
                            Agent agent - the agent
Avoid nodes [dynamic]
A node (or several nodes) that you want to exclude from the automatically calculated route for transporters.
Type of value: Node[]
Local variables: T unit - the transporter
                            Agent agent - the agent
Actions
On enter path [code]
Here you can type Java code to be executed when a transporter enters the path.
Local variables: T unit - the transporter that enters the path
                            Path path - the path the transporter enters
On exit path [code]
Here you can type Java code to be executed when a transporter exits the path.
Local variables: T unit - the transporter that exits the path
                            Path path - the path that transporter exits
On enter node [code]
Here you can type Java code to be executed when a transporter enters the node. Local variables: T unit - the transporter that enters the node
                            Node node - the node that transporter enters
On exit node [code]
Here you can type Java code to be executed when a transporter exits the node. Local variables: T unit - the transporter that exits the node
                            Node node - the node that transporter exits

Functions

RouteData findShortestPath(ILocation source, ILocation target, Node[] nodesToAvoid, Path[] pathsToAvoid)- calculates the shortest route from source to target taking into account the paths and nodes set to be excluded.