Skip to content

PROCESS

Machine, workstation or service step: a part, order or customer waits for a resource (machine, operator, server), is processed for a time, then frees it.

Seize, delay and release fused in one block; action selects which of the three steps run ("Seize Delay Release", "Seize Delay", "Delay Release", "Delay"), so the same block type covers a self-contained service, the start or end of a hold split across two blocks, or a plain timed delay. The most-used block for a simple resource-backed service step.

Family: work. Python builder: m.process(...).

Typical uses

Use PROCESS for a machine, workstation or service desk: an entity waits for a resource, is served for a time, and frees the resource. It fuses SEIZE, DELAY and RELEASE in one block. Use the separate blocks when one resource must be held across several steps. Set action to Delay for a plain wait that needs no resource.

Behaviour and rules

The action picks the steps that run. Seize Delay Release is the default. Seize Delay keeps the resource for a later RELEASE. Delay Release frees a resource that an earlier block seized. Delay uses no resource. A resource name is required unless the action is Delay or a worker fleet does the work alone.

An entity that finds no free unit joins the queue. The lower priority number is served first, and equal priorities follow the resource's queue discipline, which is first in first out by default. A request for several units is granted whole, so a waiting entity never holds part of it. A negative service time is cut to 0.

With balk_if or renege_after, entities can leave without service by a second outgoing link, and the block needs that link. With preempt on, an entity can take a unit from the lowest-priority job in service when its own priority is strictly better. Preemption works only with Seize Delay Release and not on a resource set. The preempted block's on_preempt decides whether the job resumes or restarts.

A failure or a shift end never interrupts a job in service. The unit goes out of service when the job frees it. A setup time is charged after the seize when the setup key differs from the previous job's at this block. The first job pays none unless initial_key is set.

A finite queue_capacity or a full downstream space makes a finished part keep its machine until it is accepted. The resource_summary frame reports utilization and queue length. The queue_summary frame has a row for the block when it declares balking, reneging or preemption.

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
action str 'Seize Delay Release' Which of seize/delay/release run: "Seize Delay Release", "Seize Delay", "Delay Release" or "Delay".
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/released.
resource_name str '' Name of the resource or resource set; required unless action is "Delay" or a worker_fleet does the work alone.
setup str '' time setup_unit Sequence-dependent setup time: an expression charged after the seize when this block's resource changes over, e.g. TABLE("Setups", previous_key, key). previous_key and key are in scope here only. Empty = no setup.
setup_unit str 'base' Unit of setup: "base" (the model's) or one of its quantity's units.
setup_key str '' Expression identifying what a job is set up for; empty uses the entity type. A setup is charged only when it differs from the previous job's key at this block.
initial_key str '' What the resource is already set up for at time 0; empty means the first job is charged no setup.
setup_cost str '' money Money charged ONCE PER CHANGEOVER, not per job -- an expression like TABLE("Changeover cost", previous_key, key), with previous_key and key in scope exactly as in "setup". It becomes an event cost item named after the block, joins Total Cost and resets at warm-up. Empty = free changeovers.
setup_cost_category str '' Cost category the changeover cost is grouped under in the cost_summary frame (default "Changeover").
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.
preempt bool False When no unit is free, interrupt the lowest-priority job in service on this resource (a strictly higher priority wins). Only with action "Seize Delay Release", and not on a resource set.
queue_capacity int 0 count Places in this station'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 service starts, so an upstream machine with nowhere to put its finished part stays blocked. balk_if sees the places taken as queue_length, which is how a LOSS system is written instead of a blocking one.
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).
worker_when_blocked str 'leaves' What the worker does while this station holds a finished part that nothing downstream has room for. "leaves" (the default): the worker is free when the work ends. "stays": the worker waits with the part and is free when it is accepted downstream. The same either way where nothing downstream is finite.
on_preempt str 'resume' What THIS block's job does when something interrupts it and it gets the resource back: "resume" (finish the remaining time) or "restart" (the whole service again, same sample). Set on the block being interrupted, not on the one doing the interrupting.
resample bool False With on_preempt "restart" only: draw a FRESH service time from this block's own random stream on each restart, instead of repeating the same sample. Off (the default) repeats it.

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="Lathe")
arrive = m.create(distribution=nb.Exponential(rate=0.5))
turn = m.process(resource_name="Lathe", distribution=nb.Exponential(rate=0.65))
arrive >> turn >> m.dispose()

results = m.run(seed=1)
print(round(results.kpi("resource/Lathe/Usage % (snapshot)"), 1), "% of the time the lathe is busy")
print(round(results.kpi("resource/Lathe/Time in Queue Avg"), 2), "time units mean wait")
78.7 % of the time the lathe is busy
5.64 time units mean wait

Used in

Bundled models: Emergency department: staffing game, Belt with stops, a divert and a merge, Hub day: electrifying the ground support equipment, Container terminal: electrification, Container terminal: quay to yard, Hub day: turnaround workload (crews, ground equipment, on-time departures) and 26 more.

Guides: Resources, sets and queue disciplines, Coming from SimPy, Finite buffers and blocking after service, Costing, Layout, paths and vehicles, Python API and 47 more.

See also