AnyLogic
Expand
Font size

Creating custom transporter types

If you have transporters of different types in your model with specific custom attributes (speed, charge level, etc.) and you want them to look different at model runtime, you should create custom transporter types and generate transporters of different types in your model. This document describes how to do it.

To define a custom transporter type

  1. Drag the Transporter Type element from the Material Handling Library palette into the graphical editor.

  2. The New agent wizard will open.
  3. On the first page of the wizard, specify Agent type name (e.g. AGV). Click Next to proceed to the next step.

  4. Choose animation for the transporter of this type. If you want the transporters to be animated both in 2D and 3D, choose 3D and select 3D animation shape from the list below. Otherwise, select 2D and select the figure suiting your needs from the list. Alternatively you can choose None and define animation shape later.

  5. Here you can define the parameters of the transporter. Click < add new...> and specify the parameter's name, its type and default value. To remove a parameter from the list, click the button. You can always add more parameters onto the transporter diagram after you finish creating it.

  6. Click Finish. AnyLogic will automatically open the diagram of the new transporter type. You can find the animation figure in the axis origin.

Now you can specify this transporter type in the flowchart blocks parameters, for instance, in TransporterFleet properties:

Transporter type properties

General

Name — The name of the transporter type.

Since AnyLogic generates Java class for each transporter type, you should follow Java naming guidelines. Start name with an uppercase letter.

Ignore — If selected, the transporter type is excluded from the model.

Parameters preview

Parameters preview properties are available only when this transporter type has any parameters. Here you can rearrange parameters of this transporter. Transporters of this type will list parameters in their property view in this well-defined order.

Agent actions

The parameters in this section are derived from agent type and are rarely used for transporters. For details refer to the Agent article.

On startup — Code to be executed after all agents throughout the whole model are constructed, connected, and initialized, and before anything else is done. This is a place for some additional initialization of the transporter. The order of execution of On startup code of different agents is not guaranteed.

On destroy — Code to be executed on destroying transporter of this type (e.g. when the user terminates the experiment and the root object is destroyed, On destroy code of embedded agents are executed in some order).

On arrival to target destination — This parameter is derived from agent type and is not applied to the movement defined with a Material Handling Library flowchart.

On before step — This parameter is derived from agent type and is rarely used for transporters. For details refer to the Agent article.

On step — This parameter is derived from agent type and is rarely used for transporters. For details refer to the Agent article.

Agent in flowcharts

Use in flowcharts as — Here you choose the role for agents of this type in the flowcharts. To enable using these agents as transporters in the blocks of the AnyLogic Material Handling Library, leave the Transporter option selected. This way agents of this type obtain transporter-specific functions like getFleet(), getUtilization(), getCargoPosition(), etc.

On enter flowchart block — Here you can write the code to be executed when this transporter enters the flowchart.

On exit flowchart block — Here you can write the code to be executed when this transporter exits the flowchart.

On seize resource — Here you can write the code to be executed when this transporter seizes the resource while being in the flowchart.

On release resource — Here you can write the code to be executed when this transporter releases the resource while being in the flowchart.

Dimensions and movement

Length — The length of the transporter.

Width — The width of the transporter.

Height — The height of the transporter.

Initial speed — [Visible if Space type: Continuous or GIS] The speed of the transporter.

Rotate animation towards movement — [Visible if Space type: Continuous or GIS] The heading of the transporter.

Rotate vertically as well (along Z-axis) — If selected, the transporter shape will be headed towards the target during the transporter movement.

Space and network

The parameters in this section are derived from agent type and are rarely used for transporters. For details refer to the Agent article.

Advanced Java

The parameters in this section are derived from agent type and are rarely used for transporters. For details refer to the Agent article.

Advanced

The parameters in this section are derived from agent type and are rarely used for transporters. For details refer to the Agent article.

Transporter dimensions

Since transporters typically move in the physical space, the dimensions of the transporters are essential to obtain valid simulation results. The size of each transporter is defined by three dimensions (length, width, height), which are set to 1 meter by default. For details refer to the Material item, dimensions article.

Accessing parameters of custom transporters

Since custom transporters are derived from agent type, it is possible to enrich them with custom variables, parameters, functions, and other elements.

When using a custom transporter in a process flow (for example, interacting with the transporter inside the SeizeTransporter, ReleaseTransporter, and MoveByTransporter blocks), you may need to access these elements in the context of the active transporter. In this case, you cannot directly access the transporter without specifying its type explicitly.

Let’s say we have a custom transporter fleet named AGVs that consists of multiple transporters: the AGV agents. On the AGV agent’s diagram, there is the isBusy Boolean parameter whose value is false by default — but we want to set it to true upon seizing the transporter.

To do this, specify the following as the On seize transporter action in the Actions section of the SeizeTransporter block’s properties:

((AGV)unit).isBusy = false;

We address the agent type — AGV, rather than the transporter fleet AGVs itself.

Use a similar approach to access other elements of a custom transporter type to modify their values, execute functions, and so on.

To learn more about the parameters of custom agents, see the following article: Accessing parameters of custom agents in the flowchart block parameters.

How can we improve this article?