Transporter API

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

TransporterFleet getFleet() - Returns the TransporterFleet block this transporter belongs to.

ILocation getCurrentLocation() - Returns the current location of the transporter. Via ILocation interface you can access information about the space, network, and the type of location (e.g. path offset, node, coordinates or attractor) of the transporter. For detailed information on this function, please, refer to the corresponding article of AnyLogic Help.

Utilization statistics

TransporterState getState() - Returns the current state of the transporter.
Valid values are: TransporterState.DELIVERING - transporter is transporting the material item;
TransporterState.GOING_TO_AGENT - transporter is en route to the agent;
TransporterState.GOING_HOME - transporter is returning to its home location;
TransporterState.IDLE - transporter is not busy;
TransporterState.PROCESSING - transporter is interacting with an agent (material item), i.e. loading or unloading.

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).
Parameters: state - 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.
Parameter: units - a constant defining the time units.

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].

resetStats() - Resets the transporter's utilization statistics, including the distance travelled, which is calculated by the getDistanceTravelled() function.

Speed

double getMaximumSpeed(SpeedUnits units) - Returns maximum speed value of the transporter.
Parameter: units - a constant defining the speed units.

setMaximumSpeed(double speed, SpeedUnits units) - Sets a new maximum speed value of the transporter.
Parameters: 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.
Parameter: units - a constant defining the speed units.

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.
Parameters: speed - a new maximum speed value on curved segments;
units - a constant defining the speed units.

Acceleration, deceleration

double getAcceleration(AccelerationUnits units) - Returns the acceleration value of the transporter.
Parameter: units - a constant defining the acceleration units.

setAcceleration(double acceleration, AccelerationUnits units) - Sets the new acceleration value of the transporter.
Parameters: acceleration - a new acceleration value;
units
- a constant defining the acceleration units.

double getDeceleration(AccelerationUnits units) - Returns the deceleration value of the transporter.
Parameter: units - a constant defining the acceleration units.

setDeceleration(double deceleration, AccelerationUnits units) - Sets the deceleration value of the transporter.
Parameters: deceleration - a new deceleration value;
units - a constant defining the acceleration units.

Material item position

Position getCargoPosition() - Returns the position of the material item in relation to the center point of the transporter (in the specified length units).

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).
Parameters: 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.

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.
Parameters: 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

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.

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.
Parameters: 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.

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.
Parameters: 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.

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.
Parameter: node - the node specified as the transporter's new destination;

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.
Parameter: attractor - the attractor specified as the transporter's new destination.

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.
Parameters: 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.

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.
Parameters: 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.

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.
Parameter: conveyor - the position on conveyor that serves as transporter's new destination.

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.
Parameter: 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.

Distance

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

double getDistanceTravelled(LengthUnits units) - Returns the distance the transporter has travelled from the model start or from the last call of either function resetDistanceTravelled(), function resetStats() of the individual transporters, or function resetStats() of the transporter fleet.
Parameter: units - a constant defining the length units

resetDistanceTravelled() - Resets the distance travelled by the transpoter.