AnyLogic
Expand
Font size

Transporter API

All transporters operating in a Material Handling Library flowchart provide the functions listed below:

General
Function Description
TransporterFleet getFleet() Returns the TransporterFleet block this transporter belongs to.
ILocation getCurrentLocation() Returns the current location of the transporter.
Utilization statistics
Function Description
TransporterState getState() Returns the current state of the transporter. Valid values are:
  • TransporterState.DELIVERING — the transporter is transporting the material item
  • TransporterState.GOING_TO_AGENT — the transporter is going to the agent
  • TransporterState.GOING_HOME — the transporter is returning to its home location
  • TransporterState.IDLE — the transporter is not busy
  • TransporterState.PROCESSING — the transporter is interacting with an agent (material item), that is, loading or unloading
  • TransporterState.MOVING_IDLE — the transporter is in the manual movement mode
double timeInState(TransporterState state, TimeUnits units) Returns the time this particular transporter has spent in the given state so far (in the specified time units).

state — the transporter’s state units — a constant defining the time units
double timeInState(TransporterState state) Returns the time this particular transporter has spent in the given state so far.

state — the transporter’s state
double getUtilization() Returns the transporter's utilization: the fraction of time the transporter was busy. The returned unit utilization value lies in the range [0..1].
void resetStats() Resets the transporter's utilization statistics, including the distance travelled, which is calculated by the getDistanceTravelled() function.
Speed
Function Description
double getMaximumSpeed(SpeedUnits units) Returns maximum speed value of the transporter.

units — a constant defining the speed units
void setMaximumSpeed(double speed, SpeedUnits units) Sets a new maximum speed value of the transporter.

speed — a new maximum speed value units — a constant defining the speed units
double getMaximumSpeedOnCurvedSegments(SpeedUnits units) Returns maximum permitted speed value of the transporter movement on curved segments.

units — a constant defining the speed units
void setMaximumSpeedOnCurvedSegments(double speed, SpeedUnits units) Sets a new maximum speed value of the transporter movement on curved segments. Note, that if the value you provide here exceeds the maximum speed value of the transporter, then transporter will ignore it and only accelerate to the maximum speed set by the setMaximumSpeed(double speed, SpeedUnits units) function.

speed — a new maximum speed value on curved segments
units — a constant defining the speed units
Acceleration, deceleration
Function Description
double getAcceleration(AccelerationUnits units) Returns the acceleration value of the transporter.

units — a constant defining the acceleration units
void setAcceleration(double acceleration, AccelerationUnits units) Sets the new acceleration value of the transporter.

acceleration — a new acceleration value
units — a constant defining the acceleration units
double getDeceleration(AccelerationUnits units) Returns the deceleration value of the transporter.

units — a constant defining the acceleration units
void setDeceleration(double deceleration, AccelerationUnits units) Sets the deceleration value of the transporter.

deceleration — a new deceleration value
units — a constant defining the acceleration units
Material item position
Function Description
Position getCargoPosition() Returns the position of the material item in relation to the center point of the transporter (in the specified length units).
void setCargoPosition(double dx, double dy, double dz, LengthUnits units) Sets the position of the material item in relation to the center of the transporter (in the specified length units).

dx — distance to the point on X axis
dy — distance to the point on Y axis
dz — distance to the point on Z axis
units — a constant defining the length units
void setCargoPosition(double dx, double dy, double dz, LengthUnits units, double rotation, double verticalRotation) Sets the position of the material item in relation to the center of the transporter including its horizontal and vertical orientation.

dx — distance to the point on X axis
dy — distance to the point on Y axis
dz — distance to the point on Z axis
units — a constant defining the length units rotation — horizontal orientation of the material item
verticalRotation — vertical orientation of the material item
void resetCargoPosition() Resets the position of the material item back to its default value (to the center point of the transporter).
Routing
Function Description
void recalculateRoute() Recalculates the current route of the transporter. If you have previously specified a custom route in TransporterControl block, the route will be recalculated taking into account the conditions you have set. You can only call this function when the transporter is already in movement, i.e. in either DELIVERING, or GOING_TO_AGENT, or GOING_HOME state.
void recalculateRoute(double x, double y, double z) Recalculates the current route of the transporter for the given coordinates of the new destination point. If you have previously specified a custom route in TransporterControl block, the route will be recalculated taking into account the conditions you have set. You can only call this function when the transporter is already in movement, i.e. in either DELIVERING, or GOING_TO_AGENT, or GOING_HOME state.

x — the X-coordinate of the transporter's new destination point
y — the Y-coordinate of the transporter's new destination point
z — the Z-coordinate of the transporter's new destination point
void recalculateRoute(Level level, double x, double y, double z) Recalculates the current route of the transporter for the given coordinates of the new destination point. If you have previously specified a custom route in TransporterControl block, the route will be recalculated taking into account the conditions you have set. You can only call this function when the transporter is already in movement, i.e. in either DELIVERING, or GOING_TO_AGENT, or GOING_HOME state.

level — the new level where the transporter's destination point is located
x — the X-coordinate of the transporter's new destination point
y — the Y-coordinate of the transporter's new destination point
z — the Z-coordinate of the transporter's new destination point
void recalculateRoute(Node node) Recalculates the current route of the transporter for the given new destination. If you have previously specified a custom route in TransporterControl block, the route will be recalculated taking into account the conditions you have set. You can only call this function when the transporter is already in movement, i.e. in either DELIVERING, or GOING_TO_AGENT, or GOING_HOME state.

node — the node specified as the transporter's new destination
void recalculateRoute(Attractor attractor) Recalculates the current route of the transporter for the given new destination. If you have previously specified a custom route in TransporterControl block, the route will be recalculated taking into account the conditions you have set. You can only call this function when the transporter is already in movement, i.e. in either DELIVERING, or GOING_TO_AGENT, or GOING_HOME state.

attractor — the attractor specified as the transporter's new destination
void recalculateRoute(Path path, double offset, LengthUnits units) Recalculates the current route of the transporter for the given new destination. If you have previously specified a custom route in TransporterControl block, the route will be recalculated taking into account the conditions you have set. You can only call this function when the transporter is already in movement, i.e. in either DELIVERING, or GOING_TO_AGENT, or GOING_HOME state.

path — the path where transporter's new destination point is located
offset — the distance from the starting point of the path to the transporter's new destination point
units — a constant defining the length units
void recalculateRoute(ConveyorPath conveyor, double offset, LengthUnits units) Recalculates the current route of the transporter for the given new destination. If you have previously specified a custom route in TransporterControl block, the route will be recalculated taking into account the conditions you have set. You can only call this function when the transporter is already in movement, i.e. in either DELIVERING, or GOING_TO_AGENT, or GOING_HOME state.

conveyor — the conveyor where transporter's new destination point is located
offset — the distance from the starting point of the conveyor to the transporter's new destination point
units — a constant defining the length units
void recalculateRoute(PositionOnConveyor positionOnConveyor) Recalculates the current route of the transporter for the given new destination. If you have previously specified a custom route in TransporterControl block, the route will be recalculated taking into account the conditions you have set. You can only call this function when the transporter is already in movement, i.e. in either DELIVERING, or GOING_TO_AGENT, or GOING_HOME state.

conveyor — the position on conveyor that serves as transporter's new destination
void recalculateRoute(ConveyorStation station) Recalculates the current route of the transporter for the given new destination. If you have previously specified a custom route in TransporterControl block, the route will be recalculated taking into account the conditions you have set. You can only call this function when the transporter is already in movement, i.e. in either DELIVERING, or GOING_TO_AGENT, or GOING_HOME state.

station — the station that serves as transporter's new destination
RouteData getRouteData() Returns the information about the remaining route for the transporter (from its current location to the destination). The information is returned as a list of movement tasks that the transporter will accomplish on its way to the destination. The movement tasks are listed in consecutive order from current location to target. Each task contains the information about the path and the movement type. Valid movement types are:
  • PLAIN — movement from point node to path or within network node or, in case of transporters with free space navigation, the movement within a cell of the navigation mesh
  • PATH — movement along the network path
  • PORT — movement between two network ports
Collision avoidance control
Function Description
void ignoreCollisions(boolean ignore) Controls the transporter’s ability to recognize other transporters as obstacles and to be recognized as an obstacle itself. To make transporters ignore each other, pass true as an argument. To make them recognize each other again — pass false as an argument.

ignore — if true, the transporter will ignore other transporters; if false — the transporter will stop ignoring other transporters.
void ignoreCollisionsFor(double time, TimeUnits units) Disables the transporter's ability to recognize other transporters as obstacles and to be recognized as an obstacle itself for a given period of time in specified time units. When the specified period of time runs out, the transporter goes back to acknowledging collisions with other transporters.

time — period of time during which the transporter ignores collisions
units — a constant defining the time units
Manual movement control

For more information on the specifics of manual movement control for transporters, see the corresponding sections on free space navigation and path-guided navigation.

Transporters cannot be manually moved to a point (designated by its X, Y, and Z coordinates) on another level. Instead, you can use a node as the destination.
Function Description
void move(Node node) Commands the transporter to move to the specified node in the MOVING_IDLE state.

node — The target node.
void move(Node node, TransporterState state) Commands the transporter to move to the specified node in the specified state.

node — The target node.
state — One of the transporter states. Cannot be TransporterState.IDLE.
void move(Point p) Commands the transporter to move to the specified point in the MOVING_IDLE state.

p — The Point object containing the coordinates of the destination. Should not be located on another level.
void move(Point p, TransporterState state) Commands the transporter to move to the specified point in the specified state.

p — The Point object containing the coordinates of the destination. Should not be located on another level.
state — One of the transporter states. Cannot be TransporterState.IDLE.
Distance

You can calculate the distance from the transporter to a given point with the help of agent type API inherited by the transporters.

Function Description
double getDistanceTravelled(LengthUnits units) Returns the distance the transporter has travelled from the model start or from the last call of either resetDistanceTravelled(), resetStats() of the individual transporters, or resetStats() of the transporter fleet.

units — a constant defining the length units
void resetDistanceTravelled() Resets the distance travelled by the transporter.
How can we improve this article?