Wait

This block is like
Queue
block with one exception: it supports manual retrieval (you need to call
free(), or
freeAll(). It has no ordering (except the case when preemption occurs, if the latter is turned on).
Parameters
- Capacity
- [Visible if
Maximum capacity
is not chosen] The capacity of the queue.
Syntax:
int capacity
Default value:
100
Set new value dynamically: set_capacity(new value)
- Maximum capacity
- If the option is selected (true), the capacity of the queue is maximum possible (limited by
Integer.MAX_VALUE).
Syntax:
boolean maximumCapacity
Default value:
false
- Agent location
- Space markup shape (node
or
path) where the agents are located while being in this block.
Syntax:
AnimationStaticLocationProvider entityLocation
-
Advanced
- Enable exit on timeout
- If the option is selected (true), the timeout option for the
queue
is on. After spending the specified time in the
queue, the agent will leave the block through the
outTimeout
port.
Syntax:
boolean enableTimeout
Default value:
false
- Timeout
[dynamic]
- [Visible if the
Enable exit on timeout
option is enabled] Expression evaluated to obtain the timeout time for the agent.
Value type:
double
Local variable:
agent
- the agent
Default value:
100
seconds
- Enable preemption
- If the option is selected (true), the agents are placed in the queue according to their priorities and may be preempted by higher priority ones.
Syntax:
boolean enablePreemption
Default value:
false
- Preempt
- [Visible if
Enable preemption
is
selected] Defines how the incoming agents preempt the agents that are
already in the queue. The choice defines the agent to be preempted: The most recent agent,
Agent with the least priority value,
By comparison,
The oldest agent.
Get value:
queuing
Valid values:
Wait.QUEUING_FIFO
Wait.QUEUING_PRIORITY
Wait.QUEUING_COMPARISON
Wait.QUEUING_LIFO
- Agent priority
[dynamic]
- [Visible if the
Preempt
option is
Agent with the least priority value] the priority of the incoming agent (the larger the higher).
Value type:
double
Default value:
0
Local variable:
agent
- the agent
- "agent1 may preempt agent2"
[dynamic]
- [Visible if the
Preempt
option is
By comparison] The comparison callback which should return
true
if 'agent1' has higher priority than 'agent2' (and
false
otherwise, including the case of equal priorities).
Value type:
boolean
Default value:
false
Local variables:
agent1, agent2
- the agents
- 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 this agent passes
further.
Syntax:
boolean
pushProtocol
Default value:
false
- Restore agent location on exit
- If the option is selected, after being animated in the
Agent location
shape, the agents will return to their original location (node
or
path) where they were before entering this block.
Syntax:
boolean restoreEntityLocationOnExit
- Force statistics collection
- If selected (true), statistics are collected for this and embedded blocks, otherwise statistics collection is configured by
PMLSettings
block (where the default is
true).
Syntax:
boolean forceStatisticsCollection
Default value:
false
-
Actions
-
In all these actions the current agent is available as local variable
agent.
- On enter
[code]
- Code executed when the agent enters the block (and has been placed in the queue).
- On exit
[code]
- Code executed when the agent exits the block via out port (in the normal way).
- On exit (preempted)
[code]
- [Visible if the
Enable preemption
option is enabled] Code executed when the agent exits via
outPreempted
port as a result of preemption.
- On exit (timeout)
[code]
- [Visible if the
Enable exit on timeout
option is enabled] Code executed when the agent exits via
outTimeout
port as a result of waiting too long.
- On remove
[code]
- Code executed when the agent is intentionally removed from this block by calling the agent's function
remove(). This code is automatically executed after the
remove()
function call.
Variables
- StatisticsContinuous statsSize
- The statistics on the queue size. It is collected only if the parameter
Enable statistics by default
is enabled in
PML Settings
.
Functions
int size()
- Returns the number of agents in the queue.
Agent
get(int index)
- Returns the agent at position
index
(0 is at the exit).
Agent
remove(Agent agent)
- Removes the given agent from the queue and returns it. If the agent is not contained in the queue, returns
null.
boolean free(Agent agent)
- Tells the queue to release the given agent and forward it to the 'out' port.
boolean freeAll()
- Tells the queue to release all the agents and forward it to the 'out' port.
resetStats()
- Resets the statistics collected for this block.
Iterator<Agent>
iterator()
- Returns the agent at position index (0 is at the exit).
Ports
- in
- The input port.
- out
- The output port.
- outTimeout
- The output port for agents leaving the block because of timeout.
- outPreempted
- The output port for agents leaving the block because of preemption.