Skip to content

links

Ordered list of {source, target, delay?, source_port?, target_port?, capacity?}; array order is branch order, and several links may join the same pair of blocks (a link is identified by source, target and which of the parallel links it is).

In the model file this key holds a list of entries.

A scenario, an experiment or an optimizer can set a field by the path links.<source>-><target>.<field>.

Typical uses

These sections describe the discrete flow of entities. blocks lists the steps and links joins them. sequences gives entities their own routes through stations. orders is a book of jobs, with release times and due dates, that a CREATE block releases. A simple model needs only blocks and links.

Behaviour and rules

The order of links is the branch order. The first link out of a DECIDE is branch 0, and a link out of a PROCESS with balking is index 1 for the entities that leave. Several links may join the same pair of blocks. A link can carry a delay, sampled for each entity that crosses it.

A sequence is a list of steps, each naming a STATION and the attributes to set there. An entity starts a sequence at step 0 when its CREATE block names it, or when an ASSIGN writes entity.sequence. A ROUTE block then walks the steps. A step that names a station without a STATION block is an error.

Orders only take effect when a CREATE block is in the Orders arrival mode. Each order releases quantity entities at its release time. The due time is absolute, not a lead time. An order may override the entity type, the sequence and the priority.

A scenario can override a block parameter with the path blocks.<name>.params.<parameter>. Every flow needs a CREATE and a DISPOSE, and a check reports a model that lacks one.

Fields

Field Type Required Default Unit Description
source string yes Name of the source block.
target string yes Name of the target block.
delay duration or null time (delay.time_unit) Optional transfer delay on this link; with a capacity, the time a part spends in an area link.
source_port string or integer or null Out port: a SUBMODEL instance's port name (or a whole number, matched as its text); a CONVEYOR's exit, "out" (its end) or "d<k>" (divert k); other blocks branch by link order and ignore it.
target_port string or integer or null In port: a SUBMODEL instance's port name (or a whole number, matched as its text), or a CONVEYOR's "in"; other blocks ignore it.
capacity integer 0 count Parts the link holds at once, 0 for no limit. A part keeps its place until the target takes it, so a full link holds the block feeding it. Read only on a link with a delay.

A field of a nested object is described in the JSON Schema (naga schema).

Example

The fragment refers to entries that are defined elsewhere in the same file:

{"blocks": [{"name": "create_1", "type": "CREATE", "position": [0, 0], "params": {"distribution": "Exponential", "dist_params": {"rate": 1.0}}}, {"name": "dispose_1", "type": "DISPOSE", "position": [400, 0]}]}

The fragment:

{"links": [{"source": "create_1", "target": "dispose_1"}]}

In the Python builder a >> b adds a link, and m.link(a, b, delay=...) adds one with keys.

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: Agent-based modelling, Coming from SimPy, Model file format, Submodels, Semantic diff, Quick start.

See also