SUB_EXIT¶
Editor-only blocks (SUBMODEL, SUB_ENTRY, SUB_EXIT) that group blocks into a reusable sub-model with named ports, expanded away before the run.
Editor-only placeholder shared by three types, never run directly -- core/submodels.flatten() expands them away before the engine builds any process. SUB_ENTRY: an input port of a submodel definition (port names it; exactly one outgoing link inside the definition, none incoming). SUB_EXIT: an output port of a definition (port names it; incoming links only). SUBMODEL: an instance of a definition dropped on the canvas (definition names it, arguments binds its parameters).
Family: sink. Python builder: m.sub_exit(...). Editor-only: the engine flattens it away before a run.
Typical uses¶
Use SUB_EXIT inside a submodel definition to mark where entities leave. Each output port of the definition has one. Outside, the instance's link on that port starts from the block after the SUBMODEL instance.
Behaviour and rules¶
The port names the output. A SUB_EXIT has incoming links only and no outgoing link. Port names must be unique within a definition, and a duplicate is an error.
The block never runs. Before a run, the engine removes it and joins the blocks behind it directly to the instance's outgoing link. It takes no time and adds no results. It is not a DISPOSE, so entities do not leave the model there. A definition with no SUB_EXIT whose flow ends in a block other than a DISPOSE is reported by a check.
Ports¶
- Inputs: any number of incoming links.
- Outputs: none: a flow ends here.
Parameters¶
| Parameter | Type | Default | Required | Quantity | Unit key | Description |
|---|---|---|---|---|---|---|
port |
str | 'out' |
Output port name of the definition |
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_SUBMODEL_DEAD_END |
A definition with no SUB_EXIT has a block that is not a DISPOSE dead end. |
E_SUBMODEL_SCOPE |
SUB_ENTRY/SUB_EXIT used outside a submodel definition. |
Example¶
The snippet seeds itself; its output is from a run made when this page was generated. SUB_ENTRY and SUB_EXIT are the ports of a definition, SUBMODEL an instance of it.
from nagasim import build as nb
m = nb.Model(time_limit=200)
m.add_resource(name="Lathe")
cell = m.definition("Cell") # a reusable group: SUB_ENTRY -> blocks -> SUB_EXIT
cell.sub_entry("in") >> cell.process(resource_name="Lathe", distribution=nb.Constant(value=2)) >> cell.sub_exit("out")
m.create(distribution=nb.Constant(value=5)) >> m.submodel(definition="Cell") >> m.dispose()
results = m.run(seed=1)
print(int(results.kpi("resource/Lathe/Total Seizes")), "parts went through the Cell submodel")
41 parts went through the Cell submodel
Used in¶
Bundled models: Berth: shore power, Biogas plant (library assets), 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 9 more.
Guides: Submodels.
See also¶
- All blocks, KPI reference, Model file keys, Model file format
- Same family (sink): DISPOSE