AnyLogic
Expand
Font size

Station

Use the Station space markup element to draw a simple processing station on a conveyor. The installed station doesn’t break the conveyor into two conveyors.

You can't place a station on a reversible conveyor.

The station can process more than 1 material item at a time. The maximum number of material items it can hold inside simultaneously is defined by the Capacity parameter.

The station has two processing modes:

  • Processing starts when capacity is full. The station accumulates material items until its full capacity is reached and then processes all of them simultaneously.
  • Processing starts when agent enters station. The station starts to process each material item individually as soon as its leading edge enters the station. For each material item the processing will last for the specified time. During processing the material item keeps moving through the station until it reaches the exit where it stops and waits until the processing is completed. Then it leaves the station if another material item doesn’t block its way out. The station can accommodate as many material items as defined by the Capacity parameter, but all of them can be in different stages of processing.

Changing the station's capacity at runtime

Sometimes you need to model a station with capacity that may change at some point of model run. Use the station's setCapacity() function to define a new capacity.

The station will behave in different ways depending on the station's processing mode and when exactly you call the setCapacity() function.

If capacity is set to 0, the station will not accept any new agents. The processing of items on the conveyor will be blocked.

Processing mode I want to decrease capacity I want to increase capacity
Processing starts when capacity is full
  • If the station is currently processing material items, the processing will be finished. Next time the station will accept material items according to the new decreased capacity.
  • If the station holds less material items than the specified old capacity or the processing has not finished yet, the station will start processing and AnyLogic will issue a warning message. If at the start of processing the station holds the same number of material items as the specified new capacity, there will be no warning.
  • If the station is currently empty, it will accept the material items according to the new decreased capacity. The "extra" items will wait at the entrance to the station until the next time.
  • If the station holds less material items than the specified new capacity, the station will accept the items until this new capacity is achieved and only then start processing.
  • If the station holds less material items than the specified new capacity and the processing has already started, AnyLogic will issue a warning message, but the processing will be finished. Next time the station will accept material items according to the new increased capacity.
  • If the station is currently empty or the processing has not started yet, the station will wait until it achieves the specified new capacity and only then begin the processing.
Processing starts when agent enters station
  • If the station currently holds more unprocessed material items than the specified new capacity, then no other items will be accepted until the number of the unprocessed items meets the new capacity.
  • If the number of unprocessed items inside the station is less than the specified new capacity, the station will accept items until the new capacity is reached.
  • The material items waiting at the entrance to the station will enter the station until the number of unprocessed items inside the station meets the specified new capacity.

Use the Delay parameter to specify the time that the station will spend on processing the material items.

Conveyor expects items of the same type after the station.

To draw a station

  1. Drag the Station element from the Space Markup section of the Material Handling Library palette to the agent diagram containing a conveyor. A station can be drawn only if the conveyor has been previously drawn. When moving the mouse over the agent diagram, you will see that all elements but the conveyor are temporarily hidden.
  2. Place the mouse over the conveyor just where you want to place the element. You will see that the station connects to the conveyor. Move your mouse to properly locate the element and release the mouse button when done You may change its location by dragging it along the conveyor.
  3. You can change the length of the station by dragging the rectangle point located on the element’s end with the mouse or by specifying the Length value in the element’s properties. The width of the station is automatically adjusted once you change the width of the conveyor.

To adjust position of a station

  1. Click the station you need to edit.
  2. Drag the station to the desired position on the current conveyor.
    You cannot drag it to the other conveyor.
    Alternatively, you can change the station position by modifying the Offset from conveyor start parameter in the element’s properties.

Properties

General

Name — The name of this station. The name is used to identify and access the element from code and properties of Material Handling Library blocks.

Ignore — If selected, the station is excluded from the model.

Visible on upper agent — If selected, the station is also visible on the upper agent where this agent lives.

Lock — If selected, the station is locked. Locked shapes do not react to mouse clicks - it is impossible to select them in the graphical editor until you unlock them.

Visible — Here you specify whether the shape is visible on animation at model runtime, or not. Using the control, choose yes or no.

Material item type — The type of the material item that is processed at this station. This type is automatically taken from the conveyor this station is located on. Do not change the material item type since the conveyor expects items of the same type after the station.

Delay type — The type of item release trigger:

  • Specified time — the processing ends when the specified time elapses
  • Until stopProcess() is called — the user should end the processing and release the agent by calling the function stopProcess(). If the station is in the mode, use the stopProcess(Agent agent) function.

Process time — [Visible if Delay type: Specified time] Expression evaluated to obtain the processing time for the agent. The current material item can be accessed as local variable agent.

Capacity — The maximum number of material items that the station can contain simultaneously. You can specify a new capacity in runtime.

Processing — Defines the processing mode of material items inside the station:

  • starts when capacity is full — the station waits until its Capacity is full and processes all material items simultaneously
  • starts when agent enters station — the station begins the processing of each material item individually when its leading edge enters the station

Loading — [Only visible if Processing: starts when capacity is full] Defines the loading mode of new material items to the station:

  • Simultaneous with unloading — Loading of a material item to the station may be performed simultaneously with the unloading of the processed material item from the station
  • Starts when unloading completes — Loading of a new material item will be started when all the processed material items have left the station
Resources
In the Processing starts when agent enters station mode, the resources are used with the whole station and not with individual agents (material items). Therefore, all dynamic parameters and callbacks with agent and allAgents arguments, which are related to the resources, will be called only for those agents (material items) that activate the station from its idle state. If the station is already active, i.e. it is processing the material items, such functions will not be called. In this mode the list passed as the allAgents argument will contain only the first agent that enters the station.

Use resources — Defines if the station uses a set of resource units.

Seize — Here you can choose whether the station requires resource(s) of just one single resource type (units of the same pool), or resources of different types ((alternative) resource sets). For details, refer to the following article: Resources.

Resource sets — [Visible if Seize: (alternative) resource sets]Here you define set(s) of resources required to perform the item processing. You can define several alternative resource sets (add new list by clicking the Add list button). The resource set is chosen based on the availability of resource units. For details, refer to the following article: Resources.

Resource pool — [Visible if Seize: units of the same pool] Here you specify the ResourcePool block defining the resources requested to perform the item processing. For details, refer to the following article: Resources.

Number of units — [Visible if Seize: units of the same pool] Expression evaluated to obtain the required number of resource units for the agent.

Send seized resources — If selected (true), the seized resources will be sent to the specified location. The current material item can be accessed as local variable agent.

Destination is — [Visible if Send seized resources is selected] Defines where the resources will be sent. The resources can be sent to:

  • Network node — the specified network node
  • Attractor — the specified attractor
  • (x, y, z) — the specified coordinates

Customize resource choice — If the option is selected, you can choose some specific resource units for the operation (using the Resource choice condition below). Default value is false.

Resource choice condition — The Boolean expression that is checked to find the specific resource unit(s) that can perform the operation. If no currently available resource units matches the specified condition (the condition returns false), Station will wait for the first resource unit that matches the condition.
For example, an agent can be assigned a helper resource unit that is stored in the myAssistant field within that agent. We need a particular resource unit, worker, to always be assigned to this specific agent. So in this case, the Resource choice condition is agent.myAssistant == worker.

Value type: boolean
Default value: true
Local variables:
T agent — the material item
Agent unit — the unit
List allAgents — the list of material items

Priorities / preemption

These properties are available if the Use resources option is active.

A set of resources may have multiple tasks with different priorities and preemption policies.

  • If all tasks have the same priority, they will be executed in the usual way following their occurrence schedule. If there are enough resource units available, tasks can be executed simultaneously. If two tasks have the same priority, but one of them was suspended for some reason, this suspended task will be picked1.
  • If you have configured no preemption policy for the tasks, these tasks will be executed one after another following their occurrence schedule. If there are enough resource units available, tasks can be executed simultaneously.
  • The occurrence of one task does not reset the priorities for other tasks.
1 Each resource unit may receive requests from different sources. When a single resource unit receives multiple tasks, suspended and new, with identical priority values, some rules apply to the picking order:
  • The suspended tasks from the individual queue of the resource unit have the highest priority.
    This queue is formed by agents waiting in blocks that have the Task preemption policy set to Wait for original resource.
  • After that, the suspended tasks from the queue of the ResourcePool block are processed.
    This queue is formed by agents waiting in the blocks that have the Task preemption policy set to Seize any resource.

Once the suspended tasks from these queues are completed, the resource unit begins to process new tasks from their individual queues, and after that, the queue of the ResourcePool block.

If this order does not suit your needs, manually decrease the task’s priority by code, using the On task suspended action of the block.

Task priority
The priority of the task for the incoming agent (the larger the higher).
Valid value: double
Default value: 0
Local variables:
self — the station
unit — the resource unit required for processing
agent — if the station’s mode is Processing starts when capacity is full, the first agent of all agents (material items) being processed on the station. If Processing starts when agent enters the station, this variable refers to any agent entering the station.
allAgents — a list of all agents (material items) being processed on the station. If Processing starts when agent enters the station, only 1 agent can be in this list simultaneously, so any function tied to allAgents will be called for each agent separately.
Task may preempt
If selected, a task may preempt the currently performed task (if allowed in the task properties and the task priority is lower).
Valid value: boolean
Default value: true
Local variables:
self — the station
unit — the resource unit required for processing
agent — if the station’s mode is Processing starts when capacity is full, the first agent of all agents (material items) being processed on the station. If Processing starts when agent enters the station, this variable refers to any agent entering the station.
allAgents — a list of all agents (material items) being processed on the station. If Processing starts when agent enters the station, only 1 agent can be in this list simultaneously, so any function tied to allAgents will be called for each agent separately.
Task preemption policy
Here you can choose what is done when a different task arrives for the currently busy resource unit(s):
No preemption — the current task continues executing.
Wait for original resource — the task is interrupted. Suspended agents (material items) wait for the resource unit availability near the station exit. If there is another agent already waiting, the suspended agent will wait after it.
Terminate serving — the task is interrupted. Agents (material items) whose tasks were terminated may leave the station. Enables the On task terminated action.
Seize any resource — the task is interrupted. Until a new resource unit is seized and delivered to the position specified in the Destination is property (Send seized resources should be selected), suspended agents (material items) will wait near the station exit. If there is another agent already waiting, the suspended agent will wait after it.
Continue without resource — the task is finished without resources. The agent (material item) is still being processed for the time period specified in the Process time property.
Default value: TaskPreemptionPolicy.PP_NO_PREEMPTION — No preemption
Local variables:
self — the station
unit — the resource unit required for processing
agent — if the station’s mode is Processing starts when capacity is full, the first agent of all agents (material items) being processed on the station. If Processing starts when agent enters the station, this variable refers to any agent entering the station.
allAgents — a list of all agents (material items) being processed on the station. If Processing starts when agent enters the station, only 1 agent can be in this list simultaneously, so any function tied to allAgents will be called for each agent separately.
Valid values:
TaskPreemptionPolicy.PP_NO_PREEMPTION
TaskPreemptionPolicy.PP_WAIT_FOR_ORIGINAL_RESOURCE
TaskPreemptionPolicy.PP_TERMINATE_SERVING
TaskPreemptionPolicy.PP_SEIZE_ANY_RESOURCE
TaskPreemptionPolicy.PP_CONTINUE_WITHOUT_RESOURCE
Actions

In all the actions, the current material item is accessible as the local variable agent.

On process started — Here you can type Java code executed each time when the station starts processing the item, if the station processes items one by one. If the processing at the station starts when its capacity is full, meaning, multiple items are processed simultaneously, this code will be executed only once: when the processing for the whole batch begins.

On process finished — Here you can type Java code executed each time when the station stops processing the item, if the station processes items one by one. If the processing at the station starts when its capacity is full, meaning, multiple items are processed simultaneously, this code will be executed only once: when the processing for the whole batch has been finished.

On leading edge enter — Here you can type Java code that will be executed when the leading edge of the material item reaches the station on the conveyor.

On trailing edge enter — Here you can type Java code that will be executed when the trailing edge of the material item reaches the station.

On leading edge exit — Here you can type Java code that will be executed when the leading edge of the material item leaves the station.

On trailing edge exit — Here you can type Java code that will be executed when the trailing edge of the material item leaves the station.

On failed — Here you can type Java code that will be executed in case of station failure.

On repaired — Here you can type Java code that will be executed when the station is repaired.

On task suspended — [Visible if Task preemption policy: Wait for original resource or Seize any resource] Here you can type Java code that will be executed when the material item’s processing is suspended when the resource unit receives the task with the higher priority.

On task resumed — [Visible if Task preemption policy: Wait for original resource or Seize any resource] Here you can type Java code that will be executed when the processing of the material item resumes after suspension.

On task terminated — [Visible if Task preemption policy: Terminate serving] Here you can type Java code that will be executed upon the termination of the material item processing due to preemption policies.

Appearance

Fill color — Shape’s fill color. Choose No color, if you do not want the area to be filled.

Line color — Outline color. Choose No color, if you do not want outline to be drawn.

Position and size

Offset from conveyor start — The distance (in pixels) from the starting point of the conveyor to the ending point of the station, in pixels.

Length — Defines the length of the station in the length units that you choose in the drop-down menu to the right of this field. The default length of the station is 4 meters.

Advanced

Show in — Here you can choose whether you want the shape to be shown both in 2D and 3D animation, or in 2D only, or in 3D only.

Show name — If selected, the shape name is displayed on the graphical diagram.

Functions

State
Function Description
boolean isProcessing() Returns true if the station is processing agents (material items), returns false otherwise.
boolean isProcessing(Agent agent) Returns true if the station is processing the given agent (material item), returns false otherwise (or if the station is broken).

agent — material item
void stopProcess() Stops processing agents inside at the station when called. All these agents leave the station upon the function's call. The conveyor doesn't stop and the processing of new agents that enter the station goes on as usual.
void stopProcess(Agent agent) Stops processing the given agent (material item) at the station. The given agent leaves the station upon the function's call. The conveyor doesn't stop, and the processing of other agents goes on as usual.
This function can only be called when the station is in the Processing starts when agent enters station mode. If the station is in the other processing mode, use the stopProcess() function.

agent — material item
boolean isFailed() Returns true if the station failed (broke down) and is not operating, returns false otherwise.
boolean fail() Initiates station failure. The station stops processing the agents. During the failure, new agents cannot enter the station. The agents that were inside the station and were processed at the moment of failure, remain inside until the station is repaired. The agents that have finished processing and were leaving the station, will leave it and continue their process.
boolean repair() Repairs the station, makes it available to agents again. Resumes station processing.
ConveyorSimpleStationState getState() Returns the station’s current state.

Valid values:
FAILED — the station is currently in the failure state; it does not process material items or accept new ones
IDLE — the station is currently idle; it is working, but does not process any material items
PROCESSING — the station is currently processing the material item
WAITING_FOR_RESOURCES — the station is waiting for an available resource unit to complete the processing task
Agent (material item)
Function Description
T getAgent(int index) Returns the agent (material item) with the specified index that is currently located in the station, returns null if none. The index count starts from 0 and is calculated from the exit of the station.

index — the index of the agent (material item)
List<T> getAgents() Returns the list of agents (material items) that are currently located in the station, returns null if none.
boolean contains(Agent agent) Returns true if the given agent (material item) is inside the station, returns false otherwise.
boolean removeAgent(Agent agent) Removes the given agent from the station. The agent will be removed only if it is currently located inside the station. If the agent was removed successfully, returns true, otherwise returns false.

agent — the agent (material item) to be removed from the station
Resources
Function Description
boolean isUseResources() Returns true if the station is using resource units, returns false otherwise.
boolean isSeizeFromOnePool() Returns true if the station is using resource units of the same pool, returns false otherwise.
Object getResourceDestinationType() Returns the type of destination the resources are sent to.

Valid values:
Seize.DestinationType.DEST_NODE — the node the resources are sent to
Seize.DestinationType.DEST_ATTRACTOR — the attractor the resources are sent to
Seize.DestinationType.DEST_XYZ — the coordinates the resources are sent to
Capacity
Function Description
int getCapacity() Returns the maximum number of agents (material items) that may be processed by this station simultaneously.
void setCapacity(int capacity) Sets the number of agents (material items) that may be processed by this station simultaneously. You can call this function at runtime. The station may exhibit different behaviors depending on the station's processing mode and the moment when the function has been called.
If capacity is set to 0, the station will not accept any new agents. The processing of items on the conveyor will be blocked.
capacity — the number of agents (material items)
int size() Returns the current number of agents (material items) inside the station, returns nullif none.
Loading mode
Function Description
void setLoadingMode(ConveyorSimpleStationLoadingMode mode) Defines the loading mode of new material items to the station.

mode — new loading mode.
Valid values:
SIMPLE_STATION_LOADING_MODE_SIMULTANEOUS_WITH_UNLOADING — loading of a material item to the station will be performed simultaneously with the unloading of the processed material item from the station
SIMPLE_STATION_LOADING_MODE_AFTER_UNLOADING — loading of a new material item will be started when all the processed material items have left the station
ConveyorSimpleStationLoadingMode getLoadingMode() Returns the loading mode of new material items to the station.

Valid values:
SIMPLE_STATION_LOADING_MODE_SIMULTANEOUS_WITH_UNLOADING — loading of a material item to the station will be performed simultaneously with the unloading of the processed material item from the station
SIMPLE_STATION_LOADING_MODE_AFTER_UNLOADING — loading of a new material item will be started when all the processed material items have left the station
Level
Function Description
Level getLevel() Returns the level where this station is located.
Conveyor and network
Function Description
int getConveyor() Returns the conveyor the station is located on.
double getOffset() Returns the offset from the conveyor’s starting point.
ConveyorNetwork getNetwork() Returns the network the station belongs to.
Visibility
Function Description
boolean isVisible() Returns true if the station is visible; returns false otherwise.
void setVisible(boolean v) Sets the visibility of the station.

v — visibility. If v is true — the station is set to be visible, if it is false — not visible.
Advanced
Function Description
double length(LengthUnits units) Returns the length of the station calculated in 3D space.

units — one of the length unit constants
ConveyorSimpleStationDelayType getDelayType() Returns the station’s delay type.

Valid values:
CONVEYOR_SIMPLE_STATION_DELAY_TYPE_MANUAL — the user ends the processing by calling the Delay block’s function stopProcess()
CONVEYOR_SIMPLE_STATION_DELAY_TYPE_TIMEOUT — the processing ends when the specified time elapses
Removal
Function Description
void remove() Removes the station from the presentation. If the station is not a part of presentation, the function does nothing.
Removal from the presentation does not necessarily mean removing from the model logic, since logical networks and routes may have been created before the removal and survive it.
How can we improve this article?