AnyLogic
Expand
Font size

RestrictedAreaStart

Marks the entry to the section (area) of the process where you wish to limit the maximum number of agents. Such area can only have one entry and arbitrary number of exits, each of those must be marked with block referring to this RestrictedAreaStart, see the picture below. Once the number of times RestrictedAreaStart has been entered minus the number of times RestrictedAreaEnd has been exited reaches the limit, the RestrictedAreaStart block blocks the entry and would not allow a new agent in until one of the agents exits the area.

The RestrictedAreaStart block is implemented using Hold block, so the agent is just passed to the next block and does not spend any time in RestrictedAreaStart.

If you occasionally allow agents to leave the area not through a RestrictedAreaEnd block (e.g. by programmatically removing them from the flow), the RestrictedAreaStart would not notice that and would count those agents as still being inside, which may result in the area entry blocked forever.

Parameters

Capacity (max allowed)
The maximum number of agents allowed in the restricted area.
Syntax: int capacity
Set new value at runtime: set_capacity(new value)
Default value: 10

Actions

On enter
Code executed when the agent enters the block.
Local variable: agent — the agent.

Functions

Function Description
int entitiesInside() Returns the number of agents currently in the restricted area.
boolean isBlocked() Returns true if the entry to the area is blocked, otherwise false.

Embedded block

Hold block
The embedded block that used to block the entry to the restricted area depending on the number of agents there.

Ports

in
The input port.
out
The output port.
How can we improve this article?