AnyLogic
Expand
Font size

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.

Only the collisions caused by transporters moving in opposite directions can be resolved this way. In case of two transporters moving in the same direction the following transporter just stops and waits if required.

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 Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).

Parameters

Navigation
Defines the rules of transporters movement in the network.
Automatic — the AnyLogic engine will resolve transporter collisions
Custom — you can specify your own conditions for the transporter movement along the paths and in the nodes of the network
Syntax: boolean automaticNavigation
Avoid collisions
[Visible and applies only if Navigation: 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 for the path to become available again.
Syntax: boolean avoidCollisions
Resolve collisions
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
Collision detection timeout
[Visible and applies only if the Resolve collisions option is selected]
A period of time the transporters must spend waiting at the crossroads if there is a collision to be resolved.
Value type: double
Local variable: Agent unit — the agent
Can enter node
[Visible and applies only if Navigation: 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.
Value type: boolean
Local variables:
T unit — the transporter
Agent agent — the agent
Node node — the node
Can enter path
[Visible and applies only if Navigation: 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.
Value type: boolean
Local variables:
T unit — the transporter
Agent agent — the agent
Path path — the path
Find path
By default the shortest option is selected. In this case the AnyLogic engine will always use the 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.
Value type: RouteData
Local variables:
T unit — the transporter
Agent agent — the agent
ILocation source — the source
ILocation target — the target
Avoid paths
A path (or several paths) that you want to exclude from the automatically calculated route for transporters.
Value type: Path[]
Local variables:
T unit — the transporter
Agent agent — the agent
Avoid nodes
A node (or several nodes) that you want to exclude from the automatically calculated route for transporters.
Value type: Node[]
Local variables:
T unit — the transporter
Agent agent — the agent
Include paths
A path (or several paths) that must be included in the automatically calculated route for transporters.
Value type: Node[]
Local variables:
T unit — the transporter
Agent agent — the agent

Actions

On enter path
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
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
Here you can type Java code to be executed when a transporter enters the node that is a part of a network.
Local variables:
T unit — the transporter that enters the node
Node node — the node that transporter enters
On exit node
Here you can type Java code to be executed when a transporter exits the node that is a part of a network.
Local variables:
T unit — the transporter that exits the node
Node node — the node that transporter exits

Functions

Shortest route
Function Description
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.
RouteData findShortestPath(ILocation source, ILocation target, Node[] nodesToAvoid, Path[] pathsToAvoid, Path[] pathsToInclude) Calculates the shortest route from source to target taking into account the paths and nodes set to be excluded and paths set to be included.
RouteData findShortestPath​(T unit, ILocation source, ILocation target, Node[] nodesToAvoid, Path[] pathsToAvoid, Path[] pathsToInclude) Calculates the shortest route from source to target for the given transporter taking into account the paths and nodes set to be excluded and paths set to be included.
Collisions
Function Description
int getCollisions() Returns the total number of collisions occurred in the model.
void disableCollisionAvoidanceInNodes(Collection<? extends Node> nodes) By calling this function you can disable collision control in the collection of nodes that you pass as argument. Transporters that move towards these nodes will always be able to enter and, once they have entered, will stop recognizing each other as obstacles.
How can we improve this article?