# CONVEYOR_TRANSFER

Conveyor transfer module that moves each load onto one of several exits: a pop-up transfer, a turntable or a lift, busy until the load reaches the next conveyor's photo-eye.

Family: move. Python builder: `m.conveyor_transfer(...)`.

## Typical uses

Use CONVEYOR_TRANSFER where loads change conveyors through a mechanism. A pop-up transfer lifts a load onto a side belt, a turntable turns a pallet to its exit, and a lift carries it to another level. It sits between a feeding [CONVEYOR](conveyor.md) and one receiving conveyor per exit. For a part that leaves a belt sideways with no module of its own, a divert on the belt is simpler.

## Behaviour and rules

The module holds one load at a time. It is busy from the load's entry until the handshake: the load reaching the receiving conveyor's first photo-eye. On a belt with no eye, the handshake is the load clearing that belt's entry by its own length. Only then, after any return move, does the module take the next load, so the eye's position sets the throughput. The feeding belt keeps its load until the module is free, and a full receiving belt keeps the load on the module.

Each mechanism adds its own times. A pop-up's straight exit (angle 0) adds none. A side or angled exit lifts for `lift_time`, crosses `cross_length` at `transfer_speed`, and lifts down after the handshake. A turntable turns the shorter way to the exit in `angle / turn_rate + turn_ramp`. It turns back before the next load, or with `return_home` off only once the next load waits. A lift travels `lift_height / lift_speed` each way. The travel to the load position is `entry_length`, and `transfer_speed` 0 takes the feeding belt's speed.

The `exits` list names each exit by its `port`, and a link picks its exit with `source_port`, else by order. The `rule` picks an exit per load, round robin over two or more exits by default. A rule with a limit holds the load on the module while every exit is full. The pop-up and turntable timings come from Emulate3D measurements, and a module that can never hand over is named in the deadlock error.

## Ports

- Inputs: any number of incoming links.
- Outputs: several, one for each branch; the block picks the link by its index at run time.

## Parameters

| Parameter | Type | Default | Required | Quantity | Unit key | Description |
|---|---|---|---|---|---|---|
| `mechanism` | str | `'popup'` |  |  |  | "popup" (a pop-up transfer: chains or rollers lift and carry the load sideways), "turntable" (turns the load to its exit) or "lift" (carries the load to another level). |
| `exits` | list | `[]` |  |  |  | The module's exits, in exit order: {"port": <name a link gives as its source_port>, "angle": <degrees from the entry heading, clockwise on screen: 0 straight on, 90 or -90 to a side>}. Links without a port take the exits in this order. Empty: one straight exit "out". |
| `rule` | dict | `{}` |  |  |  | Routing rule picking the exit, {"kind", "exits"?, "conditions"?, "limit"?, "attribute"?} as a Rule-mode DECIDE's; its exits default to the exits' ports. Empty: round robin over two or more exits, else the one exit. While every exit is at its limit the load waits on the module. |
| `lift_time` | float | `0.1` |  | time | `lift_time_unit` | A pop-up's lift time each way, up before a side or angled exit and down after its handshake; a straight exit has none. |
| `lift_time_unit` | str | `'seconds'` |  |  |  | Unit of `lift_time`: one of its quantity's units; "base" or absent means seconds, the unit its default was measured in. |
| `transfer_speed` | float | `0.0` |  | speed | `transfer_speed_unit` | Speed of the chains or rollers that carry the load on the module. 0: the speed of the CONVEYOR feeding it. |
| `transfer_speed_unit` | str | `'m/s'` |  |  |  | Unit of `transfer_speed`: one of its quantity's units; "base" or absent means m/s, the unit its default was measured in. |
| `cross_length` | float | `0.6` |  | length | `cross_length_unit` | A pop-up's travel from the entry to the module edge on a side or angled exit, at transfer_speed. |
| `cross_length_unit` | str | `'meters'` |  |  |  | Unit of `cross_length`: one of its quantity's units; "base" or absent means meters, the unit its default was measured in. |
| `entry_length` | float | `0.0` |  | length | `entry_length_unit` | Travel from the entry to the load's position on the module, at transfer_speed, before it moves to its exit. |
| `entry_length_unit` | str | `'meters'` |  |  |  | Unit of `entry_length`: one of its quantity's units; "base" or absent means meters, the unit its default was measured in. |
| `turn_rate` | float | `18.0` |  | rate | `turn_rate_unit` | A turntable's turning speed in degrees per time unit (per second by default); a turn of a degrees takes a / turn_rate + turn_ramp, the shorter way. |
| `turn_rate_unit` | str | `'seconds'` |  |  |  | Unit of `turn_rate`: one of its quantity's units; "base" or absent means seconds, the unit its default was measured in. |
| `turn_ramp` | float | `0.3` |  | time | `turn_ramp_unit` | Time a turntable's turn adds to speed up and slow down. |
| `turn_ramp_unit` | str | `'seconds'` |  |  |  | Unit of `turn_ramp`: one of its quantity's units; "base" or absent means seconds, the unit its default was measured in. |
| `lift_height` | float | `1.0` |  | length | `lift_height_unit` | A lift's travel between its two levels; the lift travels it up and back on every exit, whatever its angle. |
| `lift_height_unit` | str | `'meters'` |  |  |  | Unit of `lift_height`: one of its quantity's units; "base" or absent means meters, the unit its default was measured in. |
| `lift_speed` | float | `0.5` |  | speed | `lift_speed_unit` | A lift's travel speed; each way takes lift_height / lift_speed. |
| `lift_speed_unit` | str | `'m/s'` |  |  |  | Unit of `lift_speed`: one of its quantity's units; "base" or absent means m/s, the unit its default was measured in. |
| `return_home` | bool | `True` |  |  |  | A turntable turns back to its entry after each handshake, before the next load. False: it stays at the exit and turns back only once the next load waits. |
| `expose` | bool | `False` |  |  |  | True: the module writes `<module>.state` as a model variable, read with VAR("<module>.state") in a HOLD condition or item code: 0 idle (or a load standing), 1 lifting (a pop-up's lift, a lift's travel), 2 transferring (the entry travel, a pop-up's cross, boarding the exit's piece until the handshake), 3 turning (a turntable). |

## Statistics

Every run fills `system` and `entity_summary` (see the [KPI reference](../kpis.md)). The example below also fills:

| Frame | Columns |
|---|---|
| `conveyor_summary` | `Run`, `Conveyor`, `Length`, `Capacity`, `Entered`, `Exited`, `Avg Occupancy`, `Max Occupancy`, `Blocked %`, `Avg Transit Time` |
| `conveyor_eyes` | `Run`, `Conveyor`, `Eye`, `At`, `Edge`, `Fired` |
| `transfer_summary` | `Run`, `Transfer`, `Mechanism`, `Loads`, `Busy %`, `Move %`, `Handshake %`, `Rule Hold %`, `Blocked %` |
| `route_holds` | `Run`, `Block`, `Kind`, `Point`, `Holds`, `Hold Time`, `Hold %` |
| `material_flow_summary` | `Run`, `From`, `To`, `Entities` |

## Problem codes

A check of the model reports these about this block:

| Code | Meaning |
|---|---|
| `E_CONVEYOR_DIVERT` | A CONVEYOR divert is not {at, condition, time?, when_full?}, its `at` is off the belt or on another point, its condition is empty, its time is not a number >= 0 or an expression, its when_full is not wait/pass, the belt has fewer links than 1 + diverts, a "pass" divert's link does not go straight to a CONVEYOR, BUFFER or queue_capacity station, or an intercept divert has a push time or when_full, a bad on_late, or a link that is not the robot picking from it, a divert's side is not left or right, or a link out of the belt names an exit that is not out or d<k>, or a routing rule is not usable, is not on the first divert of its rule_group along the belt, has an exit count other than its group's diverts, or sits beside a condition, a robot pick or when_full "pass", or a rule exit names a target piece that is not a CONVEYOR its loads reach; or a CONVEYOR_TRANSFER's links do not match its exits one to one (a port that is not one of its exits, or named twice), or its routing rule is not usable. |
| `E_CONVEYOR_PARAM` | A CONVEYOR's type is not belt, roller, chain, pallet or mdr, or its length, speed or spacing is not a number > 0, or its gap or cell is negative, or its endpoints name unknown nodes, or its zones are not {count >= 1, release_delay >= 0} on an accumulating belt with no stop, merge or routing rule that can hold a part; or a CONVEYOR_TRANSFER's mechanism is not popup, turntable or lift, an exit is not {port, angle} or shares or holds a ':' in its port, a time, length or speed is negative (a turn_rate or lift_speed not > 0), or transfer_speed is 0 where a move needs it and no one CONVEYOR speed feeds the module; or a stop, divert, merge or eye of a belt with a path lies at or past the path's end, or a divert's angle is not a number above 0 and below 180. |
| `W_CONVEYOR_OPEN_PORT` | A conveyor piece on the floor (a CONVEYOR with a path, or a CONVEYOR_TRANSFER's exit) has a port no link joins: a belt's in, out or divert port d<k>, a transfer's exit port. An area link counts as a link. An error under simulation.strict_checks. |
| `W_ROUTE_FORBIDDEN` | In the run, a part left a divert group or a CONVEYOR_TRANSFER by an exit its routing rule cannot choose for it at that moment (an attribute changed since the rule chose, or names no exit). Warned once per block; an error that stops the run under simulation.strict_checks. |
| `W_ROUTE_RULE` | A routing rule (a divert's, a transfer's or a Rule-mode DECIDE's) has a condition per exit and no ELSE, so a part no condition takes stops the run, or it has a limit or is least_loaded while an exit leads to no CONVEYOR and names no target piece, so nothing is counted under way there; or a CONVEYOR_TRANSFER exit reaches its conveyor through a block that branches (no handshake at its eye), hands to a conveyor with no eye and a stop nearer its entry than the longest item, or counts a limit or least_loaded only until the handshake; or a merge joins a belt between the first and last divert of a rule group, so its parts are never routed; or a zoned belt has diverts, so its zone timing is not modelled behind the last divert or eye. |

## Example

The snippet seeds itself; its output is from a run made when this page was generated.

```python
from nagasim import build as nb

m = nb.Model(time_limit=60, time_unit="seconds")
arrive = m.create(distribution=nb.Constant(value=1))
feed = m.conveyor(length=2.0, speed=0.5, spacing=0.5)
popup = m.conveyor_transfer(mechanism="popup", exits=[{"port": "straight", "angle": 0},
                                                      {"port": "side", "angle": 90}])
straight = m.conveyor(length=3.0, speed=0.5, spacing=0.5, eyes=[{"at": 0.3}])
side = m.conveyor(length=3.0, speed=0.5, spacing=0.5, eyes=[{"at": 0.3}])
done = m.dispose()
arrive >> feed >> popup
m.link(popup, straight, source_port="straight")
m.link(popup, side, source_port="side")
straight >> done
side >> done

results = m.run(seed=1)
print(results["conveyor_summary"][["Conveyor", "Entered", "Exited"]].to_string(index=False))
```

```text
  Conveyor  Entered  Exited
conveyor_1       42      38
conveyor_2       19      17
conveyor_3       18      16
```

## Used in

Guides: [Layout, paths and vehicles](../../modelling-guide/layout-paths-vehicles.md).

## See also

- [All blocks](index.md), [KPI reference](../kpis.md), [Model file keys](../schema.md), [Model file format](../../model-file-format.md)
- Same family (move): [BUFFER](buffer.md), [CONVEYOR](conveyor.md), [STATION](station.md), [TRANSFER](transfer.md), [TRANSPORT](transport.md)
