Dropoff


Removes the agents contained in the incoming "container" agent and outputs them via outDropoff port. Similarly to the Pickup object that is used to add agents to the container, here agents are removed according to the given mode: all, a given number, or all satisfying the given condition. The whole operation takes zero time.

The dropoff Condition is evaluated when the agent is still in the container, but On dropoff action is executed after the agent has been removed from the container. 

An example of the drop-off condition:  assume the container contains agents of type Passenger with field destination and you wish to drop off those whose destination equals "here". Then you should specify the type Passenger as the generic parameter Container agent type and write in the drop-off condition: agent.destination == here.

Consider also using Unbatch instead of Dropoff if you do not need to keep the container agent.

Demo model: Pickup and Dropoff

Parameters

Container type [dynamic]
The type of the container agents arriving at port in. This agent type is referred to below as TContainer.
Default value: Agent
Element type [dynamic]
The type of the agents being dropped off.
Default value: Agent
Dropoff
Defines how the agents are selected to be dropped off. You can setup this object to remove All available agents from the container, a Given quantity (if available), or remove agents for which the specified boolean condition is true (While condition is true).
Get value: dropoffType
Set new value at runtime: set_dropoffType( new value )
Valid values: While condition is true        -   Dropoff.BY_CONDITION
                      Given quantity (if available) - Dropoff.QUANTITY 
                      All available agents      - Dropoff.ALL 
Condition
[Visible if Dropoff: While condition is true] Condition evaluated for each agent in the container to determine whether it should be dropped off. The condition result may depend on the container agent as well as on the "candidate" to be dropped off.
Value type: boolean
Local variables: agent - the agent to be dropped off
                          TContainer container - the container agent
Quantity [dynamic]
[Visible if Dropoff: Given quantity (if available)] Expression returning the number of agents that should be dropped off.
Value type: int
Local variable: TContainer container - the container agent
Default value: 1
Advanced
Forced pushing
If the option is selected (true), when agents finish processing at the block, they are instantly pushed further regardless the state of the succeeding block.
If the option is not selected, agents are not pushed, but pulled: only when the succeeding block is ready to accept one more agent, it requests the agent from this block, and only then the agent passes further.
Syntax: boolean pushProtocol
Default value: false
Actions
On enter [code]
Code executed when the container enters the object.
Local variable: TContainer container - the container agent
On dropoff [code]
Code executed for each agent that is removed from the container.
Local variables: agent - the agent being dropped off
                          TContainer container - the container agent
On exit [code]
Code executed when the container exits the object.
Local variable: TContainer container - the container agent
On dropoff exit [code]
Code executed for each agent being dropped off when it exits the object..
Local variables: agent - the agent being dropped off
                          TContainer container - the container agent

Ports

in
The input port.
out
The output port.
outDropoff
The output port for agents removed from the container agent.