If you have material items of different types in your model with specific custom attributes (width, length, processing cost, etc.) and you want them to look different at model runtime, you should create custom material item types and generate material items of different types in your model. This document describes how to do it.
To define a custom material item type
- Drag the Material Item Type element from the Material Handling Library palette into the graphical editor.
- The New agent wizard will open.
- On the first page of the wizard, specify Agent type name (e.g. Box). Click Next to proceed to the next step.
- Choose animation for the material item of this type. If you want the material items 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.
- Here you can define the parameters of the material item. 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 material item diagram after you finish creating it.
- Click Finish. AnyLogic will automatically open the diagram of the new material item type. You can find the animation figure in the axis origin.
- General
-
Name — The name of the material item type.
Since AnyLogic generates Java class for each material item type, you should follow Java naming guidelines. Start name with an uppercase letter.Ignore — If selected, the material item type is excluded from the model.
- Parameters preview
-
Parameters preview properties are available only when this material item type has any parameters. Here you can rearrange parameters of this material item. Material items 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 material item. 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 material item. The order of execution of On startup code of different agents is not guaranteed.
On destroy — Code to be executed on destroying a material item of this type (e.g. when the user terminates the experiment and the top-level agent is destroyed, On destroy code of embedded agents is 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 material items. For details refer to the Agent article.
On step — This parameter is derived from agent type and is rarely used for material items. 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 material items in the blocks of the AnyLogic Material Handling Library, leave the Material item option selected. This way the agents of this type obtain functions specific for material item like conveyTo(), getConveyingSpeed(), getLeadingEdgePosition(), etc.
On enter flowchart block — Here you can write the code to be executed when this material item enters the flowchart.
On exit flowchart block — Here you can write the code to be executed when this material item exits the flowchart.
On seize resource — Here you can write the code to be executed when this material item seizes the resource while being in the flowchart.
On release resource — Here you can write the code to be executed when this material item releases the resource while being in the flowchart.
- Dimensions and movement
-
Length — The length of the material item.
Width — The width of the material item.
Height — The height of the material item.
Initial speed — [Visible if Space type: Continuous or GIS] The speed of the material item.
Rotate animation towards movement — [Visible if Space type: Continuous or GIS] The heading of the material item.
Rotate vertically (incline on ramps) — If selected, the material item shape will be headed towards the target during the material item movement.
- Space and network
-
The parameters in this section are derived from agent type and are rarely used for material item. For details refer to the Agent article.
- Advanced Java
-
The parameters in this section are derived from agent type and are rarely used for material item. For details refer to the Agent article.
- Advanced
-
The parameters in this section are derived from agent type and are rarely used for material item. For details refer to the Agent article.
Since material items are typically handled in the physical space (they are transported by conveyors and occupy a certain space on them), the dimensions of the material items are essential to obtain valid simulation results. The size of each material item 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.
To generate the material items of a custom type you should choose this type (e.g. Box) in the New agent parameter of the corresponding Source block (the property is located in the Agent section of the block’s properties). This will make the flowchart use material items of this custom type, and you will be able to explicitly address the additional functionality of this material item type in the flowchart blocks.
-
How can we improve this article?
-