Skip to content

SEIZE

Waits in a queue for a machine, operator, vehicle or other resource, takes it and keeps it until a later RELEASE, so one resource can span several steps.

Request quantity units of resource_name (a plain resource or a resource set), honouring priority and the resource's queue discipline, then hold the block's own delay before forwarding. Pairs with RELEASE for a hold split across two blocks; PROCESS fuses the common Seize-Delay- Release case into one block.

balk_if and renege_after let an entity leave without ever being served, by the block's second outgoing link. Preemption is PROCESS only: the service a SEIZE starts is finished somewhere else, so there is nothing here that could safely be interrupted.

Family: resource. Python builder: m.seize(...).

Typical uses

Use SEIZE with RELEASE when one resource must stay with an entity across several blocks. Examples are an operator who follows a job through three steps, a forklift held during loading, and a bed kept for a whole stay. For a single service step on one resource, PROCESS is simpler and does the same in one block.

Behaviour and rules

The entity requests quantity units of the resource or resource set and waits in its queue. The lower priority number is served first, and equal priorities follow the resource's queue discipline. A request for several units is granted whole, so a waiting entity never holds part of it. For a set, the set's rule picks the member.

After the grant the entity spends the block's own delay, which may be 0, and moves on still holding the units. It keeps them until a RELEASE names the same resource. An entity cannot seize a name it already holds. It stops with an error that names the entity and the resource.

With balk_if or renege_after, an entity can leave without service by the second outgoing link, and the block needs that link. Preemption is not offered here, only in PROCESS. A failure or shift end does not interrupt a holder. The unit goes out of service when it is freed.

A finite queue_capacity limits the places in the block's own queue. The resource_summary frame reports seizes, utilization and queue length for the resource.

Ports

  • Inputs: any number of incoming links.
  • Outputs: one outgoing link. With balk_if or renege_after set, a second link (index 1) takes the entities that leave without service.

Parameters

Parameter Type Default Required Quantity Unit key Description
distribution str 'Constant' Name of a registered distribution (see the distribution reference).
dist_params dict {'value': 0.0} time time_unit Parameters for distribution, by name (e.g. {"rate": 0.5} for Exponential).
time_unit str 'base' Unit the sampled duration is expressed in: "base" (the model's own unit, no conversion) or one of seconds/minutes/hours/days.
priority int 0 Lower draws first when the resource's queue is contested. One number for the block (an entity attribute is not read): to rank entity types, route each to its own block on the shared resource.
quantity int 1 count Number of resource units requested.
resource_name str '' yes Name of the resource or resource set to seize.
queue_capacity int 0 count Places in this block's own input queue. 0 (the default) is an unlimited queue; with a positive value a part takes a place on arrival and frees it when it seizes, so an upstream machine with nowhere to put its finished part stays blocked.
hold_until_space bool False Blocking BEFORE service: after seizing, do not start the job until the downstream space has a free place, and reserve it for this part. The station waits idle (reported as Blocked %). Needs a downstream BUFFER with capacity > 0 or a SEIZE/PROCESS with queue_capacity > 0. Off (the default) is blocking AFTER service.
space_of str '' Which block's space hold_until_space reserves in; empty = the target of this block's first outgoing link. The part must reach that block.
worker_fleet str '' A fleet with kind "worker". After this block's own resource (if any) is seized, a worker is requested, walks EMPTY on the network to node, and is held for the service. Empty = no worker.
worker_skill str '' Only a worker whose skills contain this name may serve; empty = any worker of the fleet.
node str '' Network node this block sits on; required with worker_fleet (where the worker walks to).
balk_if str '' Condition evaluated on arrival; when true the entity does not join the queue and leaves by the second outgoing link, e.g. "queue_length >= 5". queue_length is the queue it would have joined. Empty = never balk.
renege_after str '' time renege_time_unit How long the entity waits before giving up, e.g. "EXPO(15)" or "entity.patience"; it then leaves by the second outgoing link. A grant in the same instant wins. Empty = wait for ever.
renege_time_unit str 'base' Unit renege_after is expressed in: "base" (the model's own unit) or one of seconds/minutes/hours/days.

Statistics

Every run fills system and entity_summary (see the KPI reference). The example below also fills:

Frame Columns
resource_summary Run, Resource, Total Seizes, Usage % (snapshot), Idle %, Scheduled Capacity Avg, Down %, Busy Cost, Idle Cost, Usage Cost, Total Cost, Queue Length Avg, Queue Length Max, Queue Length at End, Queue Length Mode, Queue Length Mode %, Queue Len P95, Queue Len P99, Queue Len Std, Time in Queue Avg, Time in Queue Avg (incl. waiting), Time in Queue Max, Time in Queue Mode, Time in Queue Mode %, Wait P95, Wait P99, Wait Std, Bottleneck Score, Bottleneck %
material_flow_summary Run, From, To, Entities

Problem codes

A check of the model reports these about this block:

Code Meaning
E_BUFFER_CAPACITY A BUFFER's capacity, or a SEIZE/PROCESS queue_capacity, is negative.
E_HOLD_SPACE_TARGET hold_until_space is set but the block it reserves in (space_of, or the first link's target) is not a BUFFER with capacity > 0 or a SEIZE/PROCESS with queue_capacity > 0.
E_RESOURCE_UNKNOWN A SEIZE/PROCESS/RELEASE block's resource_name names no declared resource or resource set.
E_WORKER_FLEET A SEIZE/PROCESS worker_fleet names no fleet of kind "worker".
E_WORKER_NO_NODE A SEIZE/PROCESS with worker_fleet sits on no network node.
W_QUEUE_LEAVE_LINK_UNUSED A SEIZE/PROCESS has a second outgoing link but neither balk_if nor renege_after, so nothing ever takes it.

Example

The snippet seeds itself; its output is from a run made when this page was generated.

from nagasim import build as nb

m = nb.Model(time_limit=480, warmup=60)
m.add_resource(name="Operator")
arrive = m.create(distribution=nb.Exponential(rate=0.4))
take = m.seize(resource_name="Operator")
work = m.delay(distribution=nb.Exponential(rate=0.6))
arrive >> take >> work >> m.release(resource_name="Operator") >> m.dispose()

results = m.run(seed=1)
print(round(results.kpi("resource/Operator/Usage % (snapshot)"), 1), "% of the time the operator is held")
print(round(results.kpi("resource/Operator/Time in Queue Avg"), 2), "time units mean wait for the operator")
75.3 % of the time the operator is held
4.17 time units mean wait for the operator

Used in

Bundled models: Berth: shore power, Emergency department: staffing game, Hub day: electrifying the ground support equipment, Hub day: turnaround workload (crews, ground equipment, on-time departures), Order-driven warehouse (library assets), Make-to-order line (library assets) and 6 more.

Guides: Resources, sets and queue disciplines, Digital twin, Finite buffers and blocking after service, Layout, paths and vehicles, Mobile cobots: machine tending, Coming from AnyLogic and 8 more.

See also