Skip to content

RELEASE

Frees a machine, operator or other resource that an earlier SEIZE gave the entity, after an optional delay.

Release everything the entity holds under resource_name (a plain resource or a set member), after an optional delay. Pairs with SEIZE for a hold split across two blocks; raises if the entity never seized that name (fail-loud by design).

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

Typical uses

Use RELEASE to free a resource that an earlier SEIZE or a PROCESS with the action Seize Delay gave the entity. It ends a hold that spans several blocks. A PROCESS with the default action frees its own resource, so it needs no RELEASE.

Behaviour and rules

The block waits for its optional delay and then frees every unit the entity holds under resource_name. For a set, it frees the member that was chosen at the seize. Naming a fleet frees a vehicle that a TRANSPORT kept.

If the entity holds nothing under that name, the run stops with an error that names the entity and the resource. This is deliberate, so a missing SEIZE does not pass unnoticed. A resource name that is not declared is also caught by a check.

The end of a SEIZE and RELEASE pair blocks like the end of a PROCESS. If the next block has a finite space, a finished part keeps its resource until the space accepts it. A worker that leaves when the work ends is the one exception, unless worker_when_blocked is stays.

The hold is recorded when it ends, so the busy time, the busy cost and the schedule log all count from the seize to this block.

Ports

  • Inputs: any number of incoming links.
  • Outputs: one outgoing link.

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.
resource_name str '' yes Name of the resource or resource set to release.
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.

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_RESOURCE_UNKNOWN A SEIZE/PROCESS/RELEASE block's resource_name names no declared resource or resource set.
W_TRANSPORT_KEEP_UNFREED Nothing downstream of a TRANSPORT with keep_vehicle frees the vehicle (no RELEASE naming the fleet, no TRANSPORT on it without keep_vehicle): it waits with the part until the part leaves.

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="Dock")
arrive = m.create(distribution=nb.Exponential(rate=0.2))
arrive >> m.seize(resource_name="Dock") >> m.delay(distribution=nb.Constant(value=3)) >> m.release(resource_name="Dock") >> m.dispose()

results = m.run(seed=1)
print(int(results.kpi("resource/Dock/Total Seizes")), "seizes; each ended by the RELEASE block")
79 seizes; each ended by the RELEASE block

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: Finite buffers and blocking after service, Resources, sets and queue disciplines, Layout, paths and vehicles, Coming from AnyLogic, Coming from Arena, Coming from salabim and 4 more.

See also