# TRANSPORT

Moves a part, order or load between locations with a vehicle (truck, AGV, forklift, robot) from a fleet: fetch, carry, unload, free the vehicle.

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

## Typical uses

Use TRANSPORT when a vehicle must come and fetch the entity: a forklift, an AGV, a truck, a mobile robot. It replaces the fixed transfer time of [ROUTE](route.md) with a real trip. For a fixed link time with no vehicle, use a link delay or ROUTE.

## Behaviour and rules

The block does the whole cycle. The entity requests a vehicle from the `fleet`. The vehicle drives empty to the entity's node, loads, drives loaded to the destination, unloads and is freed. The entity is delivered when the unload ends. The vehicle is busy for the whole cycle, and also for the drive home if the fleet parks at home.

The `destination` is a STATION. If it is empty, the entity goes to the next station of its sequence, as ROUTE would choose. Every time is exact geometry: the shortest path on the network divided by the fleet's loaded or empty speed, capped by any segment speed limit. A vehicle request outranks the fleet's dispatching rule by its `priority`, lower first.

With `keep_vehicle` on, the vehicle stays at the drop and the entity's next TRANSPORT on that fleet drives it with no new request. A RELEASE that names the fleet frees it, as does the entity leaving the flow. A fleet with `loads` above 1 can carry several waiting entities on one tour. The `fleet_summary` frame reports trips and distances.

## Ports

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

## Parameters

| Parameter | Type | Default | Required | Quantity | Unit key | Description |
|---|---|---|---|---|---|---|
| `fleet` | str | `''` | yes |  |  | Name of the mover fleet whose vehicles do the carrying. |
| `destination` | str | `''` |  |  |  | STATION the entity is carried to. Empty: the next station of the entity's routing, exactly as ROUTE would choose it. |
| `priority` | int | `0` |  |  |  | Request priority for a vehicle; lower is served first, and outranks the fleet's dispatching rule. |
| `keep_vehicle` | bool | `False` |  |  |  | Keep the vehicle after the drop: it waits there, busy, and the entity's next TRANSPORT on this fleet drives it. A RELEASE naming the fleet, or the entity leaving the model, frees it. |

## Statistics

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

| Frame | Columns |
|---|---|
| [`resource_summary`](../kpis.md#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 %` |
| `fleet_summary` | `Run`, `Fleet`, `Vehicles`, `Trips`, `Loads per Trip`, `Distance Loaded`, `Distance Empty`, `Travel Loaded %`, `Travel Empty %`, `Load/Unload %`, `Held %`, `Idle %`, `Avg Request Wait`, `Max Request Wait` |
| `segment_summary` | `Run`, `Segment`, `Length`, `Traversals`, `Distance Driven`, `Wait Time`, `Max Occupancy` |
| `material_flow_summary` | `Run`, `From`, `To`, `Entities` |

## Problem codes

A check of the model reports these about this block:

| Code | Meaning |
|---|---|
| `E_FLEET_UNKNOWN` | A TRANSPORT block names a fleet the model does not declare. |
| `E_TRANSPORT_KEEP_ARM` | A TRANSPORT keeps its vehicle (keep_vehicle) on a fleet with an arm; a cobot stays with its part through tending instead. |
| `E_TRAVEL_MODE` | A ROUTE/TRANSPORT travel mode is unknown, or needs a network the model does not declare. |
| `W_TENDING_STAY` | A station keeps its cobot ("stay") but no TRANSPORT of an arm fleet carries the part on. |
| `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.

```python
from nagasim import build as nb

m = nb.Model(
    time_limit=600, time_unit="seconds",
    network={"nodes": [{"name": "dock", "x": 0, "y": 0}, {"name": "yard", "x": 100, "y": 0}],
             "segments": [{"from": "dock", "to": "yard", "length": 100, "two_way": True}]})
m.add_fleet(name="Trucks", count=1, speed=5.0, home="dock", load_time="10", unload_time="10")
dock = m.station(station="Dock", node="dock")
yard = m.station(station="Yard", node="yard")
m.create(distribution=nb.Exponential(rate=1 / 120)) >> dock >> m.transport(fleet="Trucks", destination="Yard") >> yard >> m.dispose()

results = m.run(seed=1)
print(results["fleet_summary"].round(2).to_string(index=False))
```

```text
 Run  Fleet  Vehicles  Trips  Loads per Trip  Distance Loaded  Distance Empty  Travel Loaded %  Travel Empty %  Load/Unload %  Held %  Idle %  Avg Request Wait  Max Request Wait
   1 Trucks         1      8             1.0            700.0           600.0            23.33           22.22          23.33     0.0   31.11             37.21            145.22
```

## Used in

Bundled models: [Container terminal: electrification](../../gallery/logistics.md), [Container terminal: quay to yard](../../gallery/logistics.md), [Warehouse with forklifts (floor plan)](../../gallery/logistics.md), [Order-driven warehouse (library assets)](../../gallery/logistics.md), [Automation floor (robot cells, AMR, palletiser)](../../gallery/manufacturing.md).

Guides: [Layout, paths and vehicles](../../modelling-guide/layout-paths-vehicles.md), [Finite buffers and blocking after service](../../modelling-guide/finite-buffers.md), [Coming from AnyLogic](../../coming-from/anylogic.md), [Coming from Arena](../../coming-from/arena.md), [Time units and transfer delays](../../modelling-guide/time-units.md), [A plant as a timeline](../../plant-timeline.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), [CONVEYOR_TRANSFER](conveyor-transfer.md), [STATION](station.md), [TRANSFER](transfer.md)
