Skip to content

DISPOSE

End of the flow: parts, orders or customers leave the system here, and their throughput time and holding cost are recorded.

Waits an optional deletion delay, stamps deletion_time and throughput_time, accrues the entity type's WIP holding cost, and removes the entity from live_entities. Every model needs at least one DISPOSE block, and every flow that does not lead back to a CREATE must end in one (schema.validate_graph_structured).

Family: sink. Python builder: m.dispose(...).

Typical uses

Use DISPOSE where entities leave the model: shipped orders, served customers, finished parts, scrap. Every flow that does not loop back to a CREATE must end in one. Disposal is also where throughput time is recorded, so the point where you place it defines what counts as finished.

Behaviour and rules

When an entity arrives, it is marked finished. After the optional deletion delay, the block stamps its deletion time and its throughput time, which is the time since creation. The entity is then removed from the work in progress and counts in the throughput results.

If the entity type has a holding cost, the block adds that cost for the time spent in the system. Only time after the warm-up counts, so an entity created before the warm-up ended is charged from the end of the warm-up.

A DISPOSE has no outgoing link, and adding one is an error. With remove_agent on, the entity's agent is removed too, unless it has none or has already died. A model with no DISPOSE fails a check. Entities that never reach one stay in the work in progress at the end of the run.

Ports

  • Inputs: any number of incoming links.
  • Outputs: none: a flow ends here.

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.
remove_agent bool False When true, also remove the entity's agent (AgentSystem.remove_agent) at disposal, if it still has a live one. An entity with none, or whose agent already died, is a no-op.

Statistics

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

Frame Columns
material_flow_summary Run, From, To, Entities

Problem codes

A check of the model reports these about this block:

Code Meaning
E_DISPOSE_HAS_OUTPUT A DISPOSE block has an outgoing link.
E_NO_DISPOSE The model has no DISPOSE block, so nothing ever leaves.
E_SUBMODEL_DEAD_END A definition with no SUB_EXIT has a block that is not a DISPOSE dead end.
E_TERMINAL_NOT_DISPOSE A reachable block with no outgoing link is not a DISPOSE.

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=100)
m.create(distribution=nb.Exponential(rate=0.5)) >> m.delay(distribution=nb.Constant(value=3)) >> m.dispose()

results = m.run(seed=1)
print(int(results.kpi("system/Total Entities Completed")), "entities left the model")
print(round(results.kpi("system/Avg Throughput Time"), 2), "time units in the model, on average")
44 entities left the model
3.0 time units in the model, on average

Used in

Bundled models: Berth: shore power, Biogas plant (library assets), Emergency department: staffing game, Supply line: order-rate management game, Belt with stops, a divert and a merge, Hub day: electrifying the ground support equipment and 34 more.

Guides: Costing, Quick start, Coming from AnyLogic, Coming from Arena, Coming from SimPy, How do I calibrate a model to data? and 46 more.

See also